From 8df2809b4d68690a4e547037c7f217d4c24dfa3b Mon Sep 17 00:00:00 2001 From: HoLLy Date: Tue, 11 Jul 2023 19:55:12 +0200 Subject: [PATCH 1/2] Restore leftarrow shortcut to back out of diff view --- src/components/diff.rs | 1 + src/components/inspect_commit.rs | 7 +++---- src/tabs/status.rs | 14 +++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/components/diff.rs b/src/components/diff.rs index bec7572244..d4bdc6e2b9 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -864,6 +864,7 @@ impl Component for DiffComponent { .move_right(HorizontalScrollType::Right); Ok(EventState::Consumed) } else if key_match(e, self.key_config.keys.move_left) + && self.horizontal_scroll.get_right() != 0 { self.horizontal_scroll .move_right(HorizontalScrollType::Left); diff --git a/src/components/inspect_commit.rs b/src/components/inspect_commit.rs index 0ddcd30bee..6c9c599ac7 100644 --- a/src/components/inspect_commit.rs +++ b/src/components/inspect_commit.rs @@ -158,7 +158,9 @@ impl Component for InspectCommitComponent { } if let Event::Key(e) = ev { - if key_match(e, self.key_config.keys.exit_popup) { + if key_match(e, self.key_config.keys.exit_popup) + || key_match(e, self.key_config.keys.move_left) + { if self.diff.focused() { self.details.focus(true); self.diff.focus(false); @@ -172,9 +174,6 @@ impl Component for InspectCommitComponent { { self.details.focus(false); self.diff.focus(true); - } else if key_match(e, self.key_config.keys.move_left) - { - self.hide_stacked(false); } return Ok(EventState::Consumed); diff --git a/src/tabs/status.rs b/src/tabs/status.rs index 0539d5bae6..338ff3c32c 100644 --- a/src/tabs/status.rs +++ b/src/tabs/status.rs @@ -686,6 +686,14 @@ impl Status { ) .order(strings::order::NAV), ); + out.push( + CommandInfo::new( + strings::commands::diff_focus_left(&self.key_config), + true, + (self.visible && focus_on_diff) || force_all, + ) + .order(strings::order::NAV), + ); out.push( CommandInfo::new( strings::commands::diff_focus_right(&self.key_config), @@ -859,7 +867,11 @@ impl Component for Status { } else if key_match( k, self.key_config.keys.exit_popup, - ) { + ) || (key_match( + k, + self.key_config.keys.move_left, + ) && self.is_focus_on_diff()) + { self.switch_focus(match self.diff_target { DiffTarget::Stage => Focus::Stage, DiffTarget::WorkingDir => Focus::WorkDir, From 67b232ef767f38a1445ae043e5e9e32160e27d48 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Tue, 11 Jul 2023 20:20:54 +0200 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bceb31185c..c625570523 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * support 'n'/'p' key to move to the next/prev hunk in diff component [[@hamflx](https://github.com/hamflx)] ([#1523](https://github.com/extrawurst/gitui/issues/1523)) * simplify theme overrides [[@cruessler](https://github.com/cruessler)] ([#1367](https://github.com/extrawurst/gitui/issues/1367)) +* restore '←' keybind in diff viewer [[@holly-hacker](https://github.com/holly-hacker)] ([#1729](https://github.com/extrawurst/gitui/issues/1729)) ### Fixes * fix commit dialog char count for multibyte characters ([#1726](https://github.com/extrawurst/gitui/issues/1726))