diff options
Diffstat (limited to 'src/popups/branchlist.rs')
-rw-r--r-- | src/popups/branchlist.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/popups/branchlist.rs b/src/popups/branchlist.rs index f7c9b94d..599b3bea 100644 --- a/src/popups/branchlist.rs +++ b/src/popups/branchlist.rs @@ -211,6 +211,12 @@ impl Component for BranchListPopup { true, true, )); + + out.push(CommandInfo::new( + strings::commands::reset_branch(&self.key_config), + self.valid_selection(), + true, + )); } visibility_blocking(self) } @@ -277,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), @@ -288,6 +294,13 @@ impl Component for BranchListPopup { && self.has_remotes { self.queue.push(InternalEvent::FetchRemotes); + } else if key_match(e, self.key_config.keys.reset_branch) + { + if let Some(commit_id) = self.get_selected_commit() { + self.queue.push(InternalEvent::OpenResetPopup( + commit_id, + )); + } } else if key_match( e, self.key_config.keys.cmd_bar_toggle, @@ -466,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( @@ -509,7 +522,8 @@ 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) |