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.
This commit is contained in:
Stefan Haller 2024-08-15 10:28:59 +02:00
parent 7676572358
commit 0e4d266a52

View file

@ -112,7 +112,7 @@ func (s *State) SelectingHunk() bool {
} }
func (s *State) SelectingRange() 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 { func (s *State) SelectingLine() bool {