From 6a6fae9581ed759bb9834e11b3709168dba255e9 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Tue, 9 Jun 2020 16:58:28 +0200 Subject: [PATCH] show cmds in new commit popup --- src/app.rs | 7 +++---- src/components/inspect_commit.rs | 12 ++++++++++++ src/strings.rs | 9 ++++----- src/tabs/status.rs | 4 ++-- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/app.rs b/src/app.rs index d22b7a97..0e42cdab 100644 --- a/src/app.rs +++ b/src/app.rs @@ -201,10 +201,9 @@ impl App { self.revlog.update_git(ev)?; self.inspect_commit_popup.update_git(ev)?; - if let AsyncNotification::Status = ev { - //TODO: is that needed? - self.update_commands() - } + //TODO: better system for this + // can we simply process the queue here and everyone just uses the queue to schedule a cmd update? + self.update_commands(); Ok(()) } diff --git a/src/components/inspect_commit.rs b/src/components/inspect_commit.rs index 5b596239..c96b1182 100644 --- a/src/components/inspect_commit.rs +++ b/src/components/inspect_commit.rs @@ -83,6 +83,18 @@ impl Component for InspectCommitComponent { .order(1), ); + out.push(CommandInfo::new( + commands::DIFF_FOCUS_RIGHT, + self.can_focus_diff(), + (self.is_visible() && !self.diff.focused()) || force_all, + )); + + out.push(CommandInfo::new( + commands::DIFF_FOCUS_LEFT, + true, + (self.is_visible() && self.diff.focused()) || force_all, + )); + visibility_blocking(self) } diff --git a/src/strings.rs b/src/strings.rs index 55ae7fec..eb0cb97b 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -183,18 +183,17 @@ pub mod commands { "Add file or path to .gitignore", CMD_GROUP_CHANGES, ); - /// - pub static STATUS_FOCUS_LEFT: CommandText = CommandText::new( + pub static DIFF_FOCUS_LEFT: CommandText = CommandText::new( "Back [\u{2190}]", //← - "view staged changes", + "view and select changed files", CMD_GROUP_GENERAL, ); /// - pub static STATUS_FOCUS_RIGHT: CommandText = CommandText::new( + pub static DIFF_FOCUS_RIGHT: CommandText = CommandText::new( "Diff [\u{2192}]", //→ "inspect file diff", - CMD_GROUP_CHANGES, + CMD_GROUP_GENERAL, ); /// pub static QUIT: CommandText = CommandText::new( diff --git a/src/tabs/status.rs b/src/tabs/status.rs index 63c53dfc..aa71f760 100644 --- a/src/tabs/status.rs +++ b/src/tabs/status.rs @@ -298,12 +298,12 @@ impl Component for Status { { let focus_on_diff = self.focus == Focus::Diff; out.push(CommandInfo::new( - commands::STATUS_FOCUS_LEFT, + commands::DIFF_FOCUS_LEFT, true, (self.visible && focus_on_diff) || force_all, )); out.push(CommandInfo::new( - commands::STATUS_FOCUS_RIGHT, + commands::DIFF_FOCUS_RIGHT, self.can_focus_diff(), (self.visible && !focus_on_diff) || force_all, ));