From 0f9e060a006d1256f8b05048e548e802f2ea914e Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Tue, 8 Jun 2021 11:23:27 +0200 Subject: [PATCH 1/2] popups clear help commands --- src/components/branchlist.rs | 4 +++- src/components/cred.rs | 30 ++++++++++++++++-------------- src/components/externaleditor.rs | 4 ++-- src/components/pull.rs | 27 +++++++++++++++------------ src/components/push.rs | 27 +++++++++++++++------------ src/components/push_tags.rs | 26 ++++++++++++++------------ src/components/taglist.rs | 4 +++- src/strings.rs | 30 +++++++++++++++++------------- 8 files changed, 85 insertions(+), 67 deletions(-) diff --git a/src/components/branchlist.rs b/src/components/branchlist.rs index f2ba49ccfa..9b36840759 100644 --- a/src/components/branchlist.rs +++ b/src/components/branchlist.rs @@ -102,7 +102,9 @@ impl Component for BranchListComponent { force_all: bool, ) -> CommandBlocking { if self.visible || force_all { - out.clear(); + if !force_all { + out.clear(); + } out.push(CommandInfo::new( strings::commands::scroll(&self.key_config), diff --git a/src/components/cred.rs b/src/components/cred.rs index ea0abbf5e5..ecd277d4ca 100644 --- a/src/components/cred.rs +++ b/src/components/cred.rs @@ -80,22 +80,24 @@ impl Component for CredComponent { fn commands( &self, out: &mut Vec, - _force_all: bool, + force_all: bool, ) -> CommandBlocking { - if self.is_visible() { - out.clear(); - } + if self.is_visible() || force_all { + if !force_all { + out.clear(); + } - out.push(CommandInfo::new( - strings::commands::validate_msg(&self.key_config), - true, - self.visible, - )); - out.push(CommandInfo::new( - strings::commands::close_popup(&self.key_config), - true, - self.visible, - )); + out.push(CommandInfo::new( + strings::commands::validate_msg(&self.key_config), + true, + true, + )); + out.push(CommandInfo::new( + strings::commands::close_popup(&self.key_config), + true, + true, + )); + } visibility_blocking(self) } diff --git a/src/components/externaleditor.rs b/src/components/externaleditor.rs index d1db695c6c..94d3189f57 100644 --- a/src/components/externaleditor.rs +++ b/src/components/externaleditor.rs @@ -157,9 +157,9 @@ impl Component for ExternalEditorComponent { fn commands( &self, out: &mut Vec, - _force_all: bool, + force_all: bool, ) -> CommandBlocking { - if self.visible { + if self.visible && !force_all { out.clear(); } diff --git a/src/components/pull.rs b/src/components/pull.rs index 18c347716e..c50edbcbe3 100644 --- a/src/components/pull.rs +++ b/src/components/pull.rs @@ -238,20 +238,23 @@ impl Component for PullComponent { out: &mut Vec, force_all: bool, ) -> CommandBlocking { - if self.is_visible() { - out.clear(); - } + if self.is_visible() || force_all { + if !force_all { + out.clear(); + } - if self.input_cred.is_visible() { - self.input_cred.commands(out, force_all) - } else { - out.push(CommandInfo::new( - strings::commands::close_msg(&self.key_config), - !self.pending, - self.visible, - )); - visibility_blocking(self) + if self.input_cred.is_visible() { + return self.input_cred.commands(out, force_all); + } else { + out.push(CommandInfo::new( + strings::commands::close_msg(&self.key_config), + !self.pending, + self.visible, + )); + } } + + visibility_blocking(self) } fn event(&mut self, ev: Event) -> Result { diff --git a/src/components/push.rs b/src/components/push.rs index 11d9ebbef7..a36fc848a1 100644 --- a/src/components/push.rs +++ b/src/components/push.rs @@ -247,20 +247,23 @@ impl Component for PushComponent { out: &mut Vec, force_all: bool, ) -> CommandBlocking { - if self.is_visible() { - out.clear(); - } + if self.is_visible() || force_all { + if !force_all { + out.clear(); + } - if self.input_cred.is_visible() { - self.input_cred.commands(out, force_all) - } else { - out.push(CommandInfo::new( - strings::commands::close_msg(&self.key_config), - !self.pending, - self.visible, - )); - visibility_blocking(self) + if self.input_cred.is_visible() { + return self.input_cred.commands(out, force_all); + } else { + out.push(CommandInfo::new( + strings::commands::close_msg(&self.key_config), + !self.pending, + self.visible, + )); + } } + + visibility_blocking(self) } fn event(&mut self, ev: Event) -> Result { diff --git a/src/components/push_tags.rs b/src/components/push_tags.rs index f2c84207ad..94a8785835 100644 --- a/src/components/push_tags.rs +++ b/src/components/push_tags.rs @@ -204,20 +204,22 @@ impl Component for PushTagsComponent { out: &mut Vec, force_all: bool, ) -> CommandBlocking { - if self.is_visible() { - out.clear(); - } + if self.is_visible() || force_all { + if !force_all { + out.clear(); + } - if self.input_cred.is_visible() { - self.input_cred.commands(out, force_all) - } else { - out.push(CommandInfo::new( - strings::commands::close_msg(&self.key_config), - !self.pending, - self.visible, - )); - visibility_blocking(self) + if self.input_cred.is_visible() { + return self.input_cred.commands(out, force_all); + } else { + out.push(CommandInfo::new( + strings::commands::close_msg(&self.key_config), + !self.pending, + self.visible, + )); + } } + visibility_blocking(self) } fn event(&mut self, ev: Event) -> Result { diff --git a/src/components/taglist.rs b/src/components/taglist.rs index 48c411881d..d891028785 100644 --- a/src/components/taglist.rs +++ b/src/components/taglist.rs @@ -126,7 +126,9 @@ impl Component for TagListComponent { force_all: bool, ) -> CommandBlocking { if self.visible || force_all { - out.clear(); + if !force_all { + out.clear(); + } out.push(CommandInfo::new( strings::commands::scroll(&self.key_config), diff --git a/src/strings.rs b/src/strings.rs index ee57e7b6c0..48d707a587 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -308,6 +308,7 @@ pub mod commands { static CMD_GROUP_STASHING: &str = "-- Stashing --"; static CMD_GROUP_STASHES: &str = "-- Stashes --"; static CMD_GROUP_LOG: &str = "-- Log --"; + static CMD_GROUP_BRANCHES: &str = "-- Branches --"; pub fn toggle_tabs(key_config: &SharedKeyConfig) -> CommandText { CommandText::new( @@ -607,7 +608,7 @@ pub mod commands { "Open editor [{}]", key_config.get_hint(key_config.open_commit_editor), ), - "open commit editor (available in non-empty stage)", + "open commit editor (available in commit popup)", CMD_GROUP_COMMIT, ) } @@ -620,6 +621,7 @@ pub mod commands { "commit (available when commit message is non-empty)", CMD_GROUP_COMMIT, ) + .hide_help() } pub fn commit_amend(key_config: &SharedKeyConfig) -> CommandText { CommandText::new( @@ -627,7 +629,7 @@ pub mod commands { "Amend [{}]", key_config.get_hint(key_config.commit_amend), ), - "amend last commit", + "amend last commit (available in commit popup)", CMD_GROUP_COMMIT, ) } @@ -924,8 +926,9 @@ pub mod commands { key_config.get_hint(key_config.enter), ), "create branch", - CMD_GROUP_GENERAL, + CMD_GROUP_BRANCHES, ) + .hide_help() } pub fn open_branch_create_popup( key_config: &SharedKeyConfig, @@ -936,7 +939,7 @@ pub mod commands { key_config.get_hint(key_config.create_branch), ), "open create branch popup", - CMD_GROUP_GENERAL, + CMD_GROUP_BRANCHES, ) } pub fn rename_branch_confirm_msg( @@ -948,8 +951,9 @@ pub mod commands { key_config.get_hint(key_config.enter), ), "rename branch", - CMD_GROUP_GENERAL, + CMD_GROUP_BRANCHES, ) + .hide_help() } pub fn rename_branch_popup( key_config: &SharedKeyConfig, @@ -960,7 +964,7 @@ pub mod commands { key_config.get_hint(key_config.rename_branch), ), "rename branch", - CMD_GROUP_GENERAL, + CMD_GROUP_BRANCHES, ) } pub fn delete_branch_popup( @@ -972,7 +976,7 @@ pub mod commands { key_config.get_hint(key_config.delete_branch), ), "delete a branch", - CMD_GROUP_GENERAL, + CMD_GROUP_BRANCHES, ) } pub fn merge_branch_popup( @@ -984,7 +988,7 @@ pub mod commands { key_config.get_hint(key_config.merge_branch), ), "merge a branch", - CMD_GROUP_GENERAL, + CMD_GROUP_BRANCHES, ) } pub fn select_branch_popup( @@ -996,7 +1000,7 @@ pub mod commands { key_config.get_hint(key_config.enter), ), "checkout branch", - CMD_GROUP_GENERAL, + CMD_GROUP_BRANCHES, ) } pub fn toggle_branch_popup( @@ -1010,7 +1014,7 @@ pub mod commands { key_config.get_hint(key_config.tab_toggle), ), "toggle branch type (remote/local)", - CMD_GROUP_GENERAL, + CMD_GROUP_BRANCHES, ) } pub fn open_branch_select_popup( @@ -1021,8 +1025,8 @@ pub mod commands { "Branches [{}]", key_config.get_hint(key_config.select_branch), ), - "open select branch popup", - CMD_GROUP_GENERAL, + "open branch popup", + CMD_GROUP_BRANCHES, ) } @@ -1057,7 +1061,7 @@ pub mod commands { key_config.get_hint(key_config.select_tag), ), "Select commit in revlog", - CMD_GROUP_GENERAL, + CMD_GROUP_LOG, ) } From 00cfd950992836c214e4bfb2af98ade82f539b5b Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Tue, 8 Jun 2021 11:29:53 +0200 Subject: [PATCH 2/2] changelog and clippy --- CHANGELOG.md | 1 + src/components/pull.rs | 11 +++++------ src/components/push.rs | 11 +++++------ src/components/push_tags.rs | 12 ++++++------ 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea87a7f4d7..29bfaa8cbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Fixed - openssl vendoring broken on macos ([#772](https://github.com/extrawurst/gitui/issues/772)) +- amend and other commands not shown in help ([#778](https://github.com/extrawurst/gitui/issues/778)) ## [0.16.1] - 2021-06-06 diff --git a/src/components/pull.rs b/src/components/pull.rs index c50edbcbe3..552a7eecc4 100644 --- a/src/components/pull.rs +++ b/src/components/pull.rs @@ -245,13 +245,12 @@ impl Component for PullComponent { if self.input_cred.is_visible() { return self.input_cred.commands(out, force_all); - } else { - out.push(CommandInfo::new( - strings::commands::close_msg(&self.key_config), - !self.pending, - self.visible, - )); } + out.push(CommandInfo::new( + strings::commands::close_msg(&self.key_config), + !self.pending, + self.visible, + )); } visibility_blocking(self) diff --git a/src/components/push.rs b/src/components/push.rs index a36fc848a1..3815538057 100644 --- a/src/components/push.rs +++ b/src/components/push.rs @@ -254,13 +254,12 @@ impl Component for PushComponent { if self.input_cred.is_visible() { return self.input_cred.commands(out, force_all); - } else { - out.push(CommandInfo::new( - strings::commands::close_msg(&self.key_config), - !self.pending, - self.visible, - )); } + out.push(CommandInfo::new( + strings::commands::close_msg(&self.key_config), + !self.pending, + self.visible, + )); } visibility_blocking(self) diff --git a/src/components/push_tags.rs b/src/components/push_tags.rs index 94a8785835..79924c08c0 100644 --- a/src/components/push_tags.rs +++ b/src/components/push_tags.rs @@ -211,13 +211,13 @@ impl Component for PushTagsComponent { if self.input_cred.is_visible() { return self.input_cred.commands(out, force_all); - } else { - out.push(CommandInfo::new( - strings::commands::close_msg(&self.key_config), - !self.pending, - self.visible, - )); } + + out.push(CommandInfo::new( + strings::commands::close_msg(&self.key_config), + !self.pending, + self.visible, + )); } visibility_blocking(self) }