From 0e4d266a52dbddf4caa1f0fc3c21651b4721a25a Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Thu, 15 Aug 2024 10:28:59 +0200 Subject: [PATCH] Fix pressing escape after clicking in diff view When clicking in a single-file diff view to enter staging (or custom patch editing, when coming from the commit files panel), you needed to press escape twice to exit, where the first press would seemingly do nothing. The reason for this was that after clicking in the diff we end up in non-sticky range select mode, but only with a single line selected, which is basically indistinguishable from line select mode. --- pkg/gui/patch_exploring/state.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/gui/patch_exploring/state.go b/pkg/gui/patch_exploring/state.go index 730deb0c1..03c933c7e 100644 --- a/pkg/gui/patch_exploring/state.go +++ b/pkg/gui/patch_exploring/state.go @@ -112,7 +112,7 @@ func (s *State) SelectingHunk() bool { } func (s *State) SelectingRange() bool { - return s.selectMode == RANGE + return s.selectMode == RANGE && (s.rangeIsSticky || s.rangeStartLineIdx != s.selectedLineIdx) } func (s *State) SelectingLine() bool {