Skip to content

Commit 3bdb1d3

Browse files
author
Stephan Dilly
authored
popups clear help commands (#779)
* popups clear help commands
1 parent 0f4434c commit 3bdb1d3

File tree

9 files changed

+69
-52
lines changed

9 files changed

+69
-52
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
## Fixed
1414
- openssl vendoring broken on macos ([#772](https://github.com/extrawurst/gitui/issues/772))
15+
- amend and other commands not shown in help ([#778](https://github.com/extrawurst/gitui/issues/778))
1516

1617
## [0.16.1] - 2021-06-06
1718

src/components/branchlist.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ impl Component for BranchListComponent {
102102
force_all: bool,
103103
) -> CommandBlocking {
104104
if self.visible || force_all {
105-
out.clear();
105+
if !force_all {
106+
out.clear();
107+
}
106108

107109
out.push(CommandInfo::new(
108110
strings::commands::scroll(&self.key_config),

src/components/cred.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,24 @@ impl Component for CredComponent {
8080
fn commands(
8181
&self,
8282
out: &mut Vec<CommandInfo>,
83-
_force_all: bool,
83+
force_all: bool,
8484
) -> CommandBlocking {
85-
if self.is_visible() {
86-
out.clear();
87-
}
85+
if self.is_visible() || force_all {
86+
if !force_all {
87+
out.clear();
88+
}
8889

89-
out.push(CommandInfo::new(
90-
strings::commands::validate_msg(&self.key_config),
91-
true,
92-
self.visible,
93-
));
94-
out.push(CommandInfo::new(
95-
strings::commands::close_popup(&self.key_config),
96-
true,
97-
self.visible,
98-
));
90+
out.push(CommandInfo::new(
91+
strings::commands::validate_msg(&self.key_config),
92+
true,
93+
true,
94+
));
95+
out.push(CommandInfo::new(
96+
strings::commands::close_popup(&self.key_config),
97+
true,
98+
true,
99+
));
100+
}
99101

100102
visibility_blocking(self)
101103
}

src/components/externaleditor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ impl Component for ExternalEditorComponent {
157157
fn commands(
158158
&self,
159159
out: &mut Vec<CommandInfo>,
160-
_force_all: bool,
160+
force_all: bool,
161161
) -> CommandBlocking {
162-
if self.visible {
162+
if self.visible && !force_all {
163163
out.clear();
164164
}
165165

src/components/pull.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,20 +238,22 @@ impl Component for PullComponent {
238238
out: &mut Vec<CommandInfo>,
239239
force_all: bool,
240240
) -> CommandBlocking {
241-
if self.is_visible() {
242-
out.clear();
243-
}
241+
if self.is_visible() || force_all {
242+
if !force_all {
243+
out.clear();
244+
}
244245

245-
if self.input_cred.is_visible() {
246-
self.input_cred.commands(out, force_all)
247-
} else {
246+
if self.input_cred.is_visible() {
247+
return self.input_cred.commands(out, force_all);
248+
}
248249
out.push(CommandInfo::new(
249250
strings::commands::close_msg(&self.key_config),
250251
!self.pending,
251252
self.visible,
252253
));
253-
visibility_blocking(self)
254254
}
255+
256+
visibility_blocking(self)
255257
}
256258

257259
fn event(&mut self, ev: Event) -> Result<EventState> {

src/components/push.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,20 +247,22 @@ impl Component for PushComponent {
247247
out: &mut Vec<CommandInfo>,
248248
force_all: bool,
249249
) -> CommandBlocking {
250-
if self.is_visible() {
251-
out.clear();
252-
}
250+
if self.is_visible() || force_all {
251+
if !force_all {
252+
out.clear();
253+
}
253254

254-
if self.input_cred.is_visible() {
255-
self.input_cred.commands(out, force_all)
256-
} else {
255+
if self.input_cred.is_visible() {
256+
return self.input_cred.commands(out, force_all);
257+
}
257258
out.push(CommandInfo::new(
258259
strings::commands::close_msg(&self.key_config),
259260
!self.pending,
260261
self.visible,
261262
));
262-
visibility_blocking(self)
263263
}
264+
265+
visibility_blocking(self)
264266
}
265267

266268
fn event(&mut self, ev: Event) -> Result<EventState> {

src/components/push_tags.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,20 +204,22 @@ impl Component for PushTagsComponent {
204204
out: &mut Vec<CommandInfo>,
205205
force_all: bool,
206206
) -> CommandBlocking {
207-
if self.is_visible() {
208-
out.clear();
209-
}
207+
if self.is_visible() || force_all {
208+
if !force_all {
209+
out.clear();
210+
}
211+
212+
if self.input_cred.is_visible() {
213+
return self.input_cred.commands(out, force_all);
214+
}
210215

211-
if self.input_cred.is_visible() {
212-
self.input_cred.commands(out, force_all)
213-
} else {
214216
out.push(CommandInfo::new(
215217
strings::commands::close_msg(&self.key_config),
216218
!self.pending,
217219
self.visible,
218220
));
219-
visibility_blocking(self)
220221
}
222+
visibility_blocking(self)
221223
}
222224

223225
fn event(&mut self, ev: Event) -> Result<EventState> {

src/components/taglist.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ impl Component for TagListComponent {
126126
force_all: bool,
127127
) -> CommandBlocking {
128128
if self.visible || force_all {
129-
out.clear();
129+
if !force_all {
130+
out.clear();
131+
}
130132

131133
out.push(CommandInfo::new(
132134
strings::commands::scroll(&self.key_config),

src/strings.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ pub mod commands {
308308
static CMD_GROUP_STASHING: &str = "-- Stashing --";
309309
static CMD_GROUP_STASHES: &str = "-- Stashes --";
310310
static CMD_GROUP_LOG: &str = "-- Log --";
311+
static CMD_GROUP_BRANCHES: &str = "-- Branches --";
311312

312313
pub fn toggle_tabs(key_config: &SharedKeyConfig) -> CommandText {
313314
CommandText::new(
@@ -607,7 +608,7 @@ pub mod commands {
607608
"Open editor [{}]",
608609
key_config.get_hint(key_config.open_commit_editor),
609610
),
610-
"open commit editor (available in non-empty stage)",
611+
"open commit editor (available in commit popup)",
611612
CMD_GROUP_COMMIT,
612613
)
613614
}
@@ -620,14 +621,15 @@ pub mod commands {
620621
"commit (available when commit message is non-empty)",
621622
CMD_GROUP_COMMIT,
622623
)
624+
.hide_help()
623625
}
624626
pub fn commit_amend(key_config: &SharedKeyConfig) -> CommandText {
625627
CommandText::new(
626628
format!(
627629
"Amend [{}]",
628630
key_config.get_hint(key_config.commit_amend),
629631
),
630-
"amend last commit",
632+
"amend last commit (available in commit popup)",
631633
CMD_GROUP_COMMIT,
632634
)
633635
}
@@ -924,8 +926,9 @@ pub mod commands {
924926
key_config.get_hint(key_config.enter),
925927
),
926928
"create branch",
927-
CMD_GROUP_GENERAL,
929+
CMD_GROUP_BRANCHES,
928930
)
931+
.hide_help()
929932
}
930933
pub fn open_branch_create_popup(
931934
key_config: &SharedKeyConfig,
@@ -936,7 +939,7 @@ pub mod commands {
936939
key_config.get_hint(key_config.create_branch),
937940
),
938941
"open create branch popup",
939-
CMD_GROUP_GENERAL,
942+
CMD_GROUP_BRANCHES,
940943
)
941944
}
942945
pub fn rename_branch_confirm_msg(
@@ -948,8 +951,9 @@ pub mod commands {
948951
key_config.get_hint(key_config.enter),
949952
),
950953
"rename branch",
951-
CMD_GROUP_GENERAL,
954+
CMD_GROUP_BRANCHES,
952955
)
956+
.hide_help()
953957
}
954958
pub fn rename_branch_popup(
955959
key_config: &SharedKeyConfig,
@@ -960,7 +964,7 @@ pub mod commands {
960964
key_config.get_hint(key_config.rename_branch),
961965
),
962966
"rename branch",
963-
CMD_GROUP_GENERAL,
967+
CMD_GROUP_BRANCHES,
964968
)
965969
}
966970
pub fn delete_branch_popup(
@@ -972,7 +976,7 @@ pub mod commands {
972976
key_config.get_hint(key_config.delete_branch),
973977
),
974978
"delete a branch",
975-
CMD_GROUP_GENERAL,
979+
CMD_GROUP_BRANCHES,
976980
)
977981
}
978982
pub fn merge_branch_popup(
@@ -984,7 +988,7 @@ pub mod commands {
984988
key_config.get_hint(key_config.merge_branch),
985989
),
986990
"merge a branch",
987-
CMD_GROUP_GENERAL,
991+
CMD_GROUP_BRANCHES,
988992
)
989993
}
990994
pub fn select_branch_popup(
@@ -996,7 +1000,7 @@ pub mod commands {
9961000
key_config.get_hint(key_config.enter),
9971001
),
9981002
"checkout branch",
999-
CMD_GROUP_GENERAL,
1003+
CMD_GROUP_BRANCHES,
10001004
)
10011005
}
10021006
pub fn toggle_branch_popup(
@@ -1010,7 +1014,7 @@ pub mod commands {
10101014
key_config.get_hint(key_config.tab_toggle),
10111015
),
10121016
"toggle branch type (remote/local)",
1013-
CMD_GROUP_GENERAL,
1017+
CMD_GROUP_BRANCHES,
10141018
)
10151019
}
10161020
pub fn open_branch_select_popup(
@@ -1021,8 +1025,8 @@ pub mod commands {
10211025
"Branches [{}]",
10221026
key_config.get_hint(key_config.select_branch),
10231027
),
1024-
"open select branch popup",
1025-
CMD_GROUP_GENERAL,
1028+
"open branch popup",
1029+
CMD_GROUP_BRANCHES,
10261030
)
10271031
}
10281032

@@ -1057,7 +1061,7 @@ pub mod commands {
10571061
key_config.get_hint(key_config.select_tag),
10581062
),
10591063
"Select commit in revlog",
1060-
CMD_GROUP_GENERAL,
1064+
CMD_GROUP_LOG,
10611065
)
10621066
}
10631067

0 commit comments

Comments
 (0)