diff --git a/src/app.rs b/src/app.rs index ec1294be2d..f75d147a5f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2,10 +2,10 @@ use crate::{ accessors, cmdbar::CommandBar, components::{ - event_pump, AppOption, BlameFileComponent, - BranchListComponent, CommandBlocking, CommandInfo, - CommitComponent, CompareCommitsComponent, Component, - ConfirmComponent, CreateBranchComponent, DrawableComponent, + command_pump, event_pump, AppOption, BlameFileComponent, + BranchListComponent, CommandInfo, CommitComponent, + CompareCommitsComponent, Component, ConfirmComponent, + CreateBranchComponent, DrawableComponent, ExternalEditorComponent, FetchComponent, FileFindPopup, FileRevlogComponent, HelpComponent, InspectCommitComponent, MsgComponent, OptionsPopupComponent, PullComponent, @@ -1056,14 +1056,7 @@ impl App { fn commands(&self, force_all: bool) -> Vec { let mut res = Vec::new(); - for c in self.components() { - if c.commands(&mut res, force_all) - != CommandBlocking::PassingOn - && !force_all - { - break; - } - } + command_pump(&mut res, force_all, &self.components()); res.push(CommandInfo::new( strings::commands::find_file(&self.key_config), diff --git a/src/components/branchlist.rs b/src/components/branchlist.rs index b27600a850..8fd2b484dd 100644 --- a/src/components/branchlist.rs +++ b/src/components/branchlist.rs @@ -115,6 +115,9 @@ impl Component for BranchListComponent { out.clear(); } + let selection_is_cur_branch = + self.selection_is_cur_branch(); + out.push(CommandInfo::new( strings::commands::scroll(&self.key_config), true, @@ -139,7 +142,7 @@ impl Component for BranchListComponent { strings::commands::compare_with_head( &self.key_config, ), - !self.selection_is_cur_branch(), + !selection_is_cur_branch, true, )); @@ -156,8 +159,7 @@ impl Component for BranchListComponent { strings::commands::select_branch_popup( &self.key_config, ), - !self.selection_is_cur_branch() - && self.valid_selection(), + !selection_is_cur_branch && self.valid_selection(), true, )); @@ -173,7 +175,7 @@ impl Component for BranchListComponent { strings::commands::delete_branch_popup( &self.key_config, ), - !self.selection_is_cur_branch(), + !selection_is_cur_branch, true, )); @@ -181,7 +183,7 @@ impl Component for BranchListComponent { strings::commands::merge_branch_popup( &self.key_config, ), - !self.selection_is_cur_branch(), + !selection_is_cur_branch, true, )); @@ -189,7 +191,7 @@ impl Component for BranchListComponent { strings::commands::branch_popup_rebase( &self.key_config, ), - !self.selection_is_cur_branch(), + !selection_is_cur_branch, true, ));