Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
extrawurst committed Apr 7, 2024
1 parent c73f2f2 commit 51f32eb
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/popups/branchlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl Component for BranchListPopup {
) && self.valid_selection()
{
self.hide();
if let Some(commit_id) = self.get_selected() {
if let Some(commit_id) = self.get_selected_commit() {
self.queue.push(InternalEvent::OpenPopup(
StackablePopupOpen::CompareCommits(
InspectCommitOpen::new(commit_id),
Expand All @@ -296,9 +296,9 @@ impl Component for BranchListPopup {
self.queue.push(InternalEvent::FetchRemotes);
} else if key_match(e, self.key_config.keys.reset_branch)
{
if let Some(b) = self.get_selected_branch() {
if let Some(commit_id) = self.get_selected_commit() {
self.queue.push(InternalEvent::OpenResetPopup(
b.top_commit,
commit_id,
));
}
} else if key_match(
Expand Down Expand Up @@ -479,7 +479,7 @@ impl BranchListPopup {
}

fn inspect_head_of_branch(&mut self) {
if let Some(commit_id) = self.get_selected() {
if let Some(commit_id) = self.get_selected_commit() {
self.hide();
self.queue.push(InternalEvent::OpenPopup(
StackablePopupOpen::InspectCommit(
Expand Down Expand Up @@ -522,16 +522,13 @@ impl BranchListPopup {
.count() > 0
}

fn get_selected(&self) -> Option<CommitId> {
// top commit of selected branch
fn get_selected_commit(&self) -> Option<CommitId> {
self.branches
.get(usize::from(self.selection))
.map(|b| b.top_commit)
}

fn get_selected_branch(&self) -> Option<&BranchInfo> {
self.branches.get(usize::from(self.selection))
}

///
fn move_selection(&mut self, scroll: ScrollType) -> Result<bool> {
let new_selection = match scroll {
Expand Down

0 comments on commit 51f32eb

Please sign in to comment.