From 7e8e3a0bd588d30aea014117d0f0847deb496f84 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Sun, 10 May 2020 14:37:15 +0200 Subject: [PATCH] show tab button in help and fix help for diff (fixes #48) --- src/app.rs | 9 +++++++++ src/components/diff.rs | 15 +++++++-------- src/strings.rs | 6 ++++++ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/app.rs b/src/app.rs index 6d044a4a..3b08d002 100644 --- a/src/app.rs +++ b/src/app.rs @@ -415,6 +415,15 @@ impl App { ); } + res.push( + CommandInfo::new( + commands::TOGGLE_TABS, + true, + !self.any_popup_visible(), + ) + .hidden(), + ); + res.push( CommandInfo::new( commands::QUIT, diff --git a/src/components/diff.rs b/src/components/diff.rs index 09706ead..f062ebf9 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -350,16 +350,15 @@ impl Component for DiffComponent { .hidden(), ); - let cmd_text = if self.current.is_stage { - commands::DIFF_HUNK_REMOVE - } else { - commands::DIFF_HUNK_ADD - }; - out.push(CommandInfo::new( - cmd_text, + commands::DIFF_HUNK_REMOVE, self.selected_hunk.is_some(), - self.focused, + self.focused && self.current.is_stage, + )); + out.push(CommandInfo::new( + commands::DIFF_HUNK_ADD, + self.selected_hunk.is_some(), + self.focused && !self.current.is_stage, )); CommandBlocking::PassingOn diff --git a/src/strings.rs b/src/strings.rs index 39b9bdbd..11ce73dc 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -24,6 +24,12 @@ pub mod commands { static CMD_GROUP_CHANGES: &str = "Changes"; static CMD_GROUP_COMMIT: &str = "Commit"; + /// + pub static TOGGLE_TABS: CommandText = CommandText::new( + "Tabs [tabs]", + "switch top level tabs", + CMD_GROUP_GENERAL, + ); /// pub static HELP_OPEN: CommandText = CommandText::new( "Help [h]",