popups clear help commands (#779)

* popups clear help commands
This commit is contained in:
Stephan Dilly 2021-06-08 11:48:12 +02:00 committed by GitHub
parent 0f4434cdb6
commit 3bdb1d3a1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 69 additions and 52 deletions

View file

@ -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

View file

@ -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),

View file

@ -80,22 +80,24 @@ impl Component for CredComponent {
fn commands(
&self,
out: &mut Vec<CommandInfo>,
_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)
}

View file

@ -157,9 +157,9 @@ impl Component for ExternalEditorComponent {
fn commands(
&self,
out: &mut Vec<CommandInfo>,
_force_all: bool,
force_all: bool,
) -> CommandBlocking {
if self.visible {
if self.visible && !force_all {
out.clear();
}

View file

@ -238,20 +238,22 @@ impl Component for PullComponent {
out: &mut Vec<CommandInfo>,
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 {
if self.input_cred.is_visible() {
return self.input_cred.commands(out, force_all);
}
out.push(CommandInfo::new(
strings::commands::close_msg(&self.key_config),
!self.pending,
self.visible,
));
visibility_blocking(self)
}
visibility_blocking(self)
}
fn event(&mut self, ev: Event) -> Result<EventState> {

View file

@ -247,20 +247,22 @@ impl Component for PushComponent {
out: &mut Vec<CommandInfo>,
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 {
if self.input_cred.is_visible() {
return self.input_cred.commands(out, force_all);
}
out.push(CommandInfo::new(
strings::commands::close_msg(&self.key_config),
!self.pending,
self.visible,
));
visibility_blocking(self)
}
visibility_blocking(self)
}
fn event(&mut self, ev: Event) -> Result<EventState> {

View file

@ -204,20 +204,22 @@ impl Component for PushTagsComponent {
out: &mut Vec<CommandInfo>,
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() {
return self.input_cred.commands(out, force_all);
}
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)
}
visibility_blocking(self)
}
fn event(&mut self, ev: Event) -> Result<EventState> {

View file

@ -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),

View file

@ -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,
)
}