Skip to content

Commit 7e8e3a0

Browse files
author
Stephan Dilly
committed
show tab button in help and fix help for diff (fixes #48)
1 parent 5f08bd6 commit 7e8e3a0

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

src/app.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,15 @@ impl App {
415415
);
416416
}
417417

418+
res.push(
419+
CommandInfo::new(
420+
commands::TOGGLE_TABS,
421+
true,
422+
!self.any_popup_visible(),
423+
)
424+
.hidden(),
425+
);
426+
418427
res.push(
419428
CommandInfo::new(
420429
commands::QUIT,

src/components/diff.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,16 +350,15 @@ impl Component for DiffComponent {
350350
.hidden(),
351351
);
352352

353-
let cmd_text = if self.current.is_stage {
354-
commands::DIFF_HUNK_REMOVE
355-
} else {
356-
commands::DIFF_HUNK_ADD
357-
};
358-
359353
out.push(CommandInfo::new(
360-
cmd_text,
354+
commands::DIFF_HUNK_REMOVE,
361355
self.selected_hunk.is_some(),
362-
self.focused,
356+
self.focused && self.current.is_stage,
357+
));
358+
out.push(CommandInfo::new(
359+
commands::DIFF_HUNK_ADD,
360+
self.selected_hunk.is_some(),
361+
self.focused && !self.current.is_stage,
363362
));
364363

365364
CommandBlocking::PassingOn

src/strings.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ pub mod commands {
2424
static CMD_GROUP_CHANGES: &str = "Changes";
2525
static CMD_GROUP_COMMIT: &str = "Commit";
2626

27+
///
28+
pub static TOGGLE_TABS: CommandText = CommandText::new(
29+
"Tabs [tabs]",
30+
"switch top level tabs",
31+
CMD_GROUP_GENERAL,
32+
);
2733
///
2834
pub static HELP_OPEN: CommandText = CommandText::new(
2935
"Help [h]",

0 commit comments

Comments
 (0)