Skip to content

Commit a58770e

Browse files
committed
Fix pressing shift-down 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), and then pressing shift-down or shift-up to select a range, it would move the selected line rather than creating a range. Only on the next press would it start to select a range from there. This is very similar to the fix we made for pressing escape in 0e4d266.
1 parent 7655f68 commit a58770e

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

pkg/gui/patch_exploring/state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (s *State) ToggleStickySelectRange() {
9494
}
9595

9696
func (s *State) ToggleSelectRange(sticky bool) {
97-
if s.selectMode == RANGE {
97+
if s.SelectingRange() {
9898
s.selectMode = LINE
9999
} else {
100100
s.selectMode = RANGE

pkg/integration/tests/ui/range_select.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,11 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
159159
SelectedLines(
160160
Contains("line 1"),
161161
).
162-
Press(keys.Universal.RangeSelectDown)
163-
if lineIdxOfFirstItem == 6 {
164-
v.SelectedLines(
165-
// bug: it moved to line 2 instead of selecting both line 1 and line 2
166-
Contains("line 2"),
167-
)
168-
} else {
169-
// works correctly in list views though
170-
v.SelectedLines(
162+
Press(keys.Universal.RangeSelectDown).
163+
SelectedLines(
171164
Contains("line 1"),
172165
Contains("line 2"),
173166
)
174-
}
175167
}
176168

177169
assertRangeSelectBehaviour(t.Views().Commits().Focus(), t.Views().Branches(), 0)

0 commit comments

Comments
 (0)