diff --git a/src/components/help.rs b/src/components/help.rs index 376f1f4a..afae7235 100644 --- a/src/components/help.rs +++ b/src/components/help.rs @@ -99,26 +99,22 @@ impl Component for HelpComponent { out.clear(); } - out.push( - CommandInfo::new( - commands::HELP_OPEN, + if self.visible { + out.push(CommandInfo::new(commands::SCROLL, true, true)); + + out.push(CommandInfo::new( + commands::CLOSE_POPUP, true, - !self.visible, - ) - .order(99), - ); + true, + )); + } - out.push(CommandInfo::new( - commands::SCROLL, - true, - self.visible, - )); - - out.push(CommandInfo::new( - commands::CLOSE_POPUP, - true, - self.visible, - )); + if !self.visible || force_all { + out.push( + CommandInfo::new(commands::HELP_OPEN, true, true) + .order(99), + ); + } visibility_blocking(self) } diff --git a/src/components/inspect_commit.rs b/src/components/inspect_commit.rs index a78141f4..db10861e 100644 --- a/src/components/inspect_commit.rs +++ b/src/components/inspect_commit.rs @@ -75,28 +75,24 @@ impl Component for InspectCommitComponent { force_all, self.components().as_slice(), ); - } - out.push( - CommandInfo::new( - commands::CLOSE_POPUP, + out.push( + CommandInfo::new(commands::CLOSE_POPUP, true, true) + .order(1), + ); + + out.push(CommandInfo::new( + commands::DIFF_FOCUS_RIGHT, + self.can_focus_diff(), + !self.diff.focused() || force_all, + )); + + out.push(CommandInfo::new( + commands::DIFF_FOCUS_LEFT, true, - self.is_visible(), - ) - .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, - )); + self.diff.focused() || force_all, + )); + } visibility_blocking(self) } diff --git a/src/components/stashmsg.rs b/src/components/stashmsg.rs index 2d15cbd1..f4122d6a 100644 --- a/src/components/stashmsg.rs +++ b/src/components/stashmsg.rs @@ -38,13 +38,16 @@ impl Component for StashMsgComponent { out: &mut Vec, force_all: bool, ) -> CommandBlocking { - self.input.commands(out, force_all); + if self.is_visible() || force_all { + self.input.commands(out, force_all); + + out.push(CommandInfo::new( + commands::STASHING_CONFIRM_MSG, + true, + true, + )); + } - out.push(CommandInfo::new( - commands::STASHING_CONFIRM_MSG, - true, - self.is_visible() || force_all, - )); visibility_blocking(self) }