summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstk <stk@ableton.com>2023-02-14 09:43:22 +0100
committerstk <stk@ableton.com>2023-02-15 21:29:00 +0100
commitb499eba1a8907db6ad95bec5bb0f8817145a327a (patch)
tree077083a635369277a05853c122d7d73fcaeffe35
parent97daec722814bac82580fbce3fe6b3f9a5527630 (diff)
Select next stageable line correctly after staging a range of lines
We already have this very convenient behavior of jumping to the next stageable line after staging something. However, while this worked well for staging single lines or hunks, it didn't work correctly when staging a range of lines; in this case we want to start searching from the first line of the range.
-rw-r--r--pkg/gui/controllers/staging_controller.go3
-rw-r--r--pkg/integration/tests/commit/stage_range_of_lines.go3
2 files changed, 2 insertions, 4 deletions
diff --git a/pkg/gui/controllers/staging_controller.go b/pkg/gui/controllers/staging_controller.go
index 78129ebe0..0a8ca5521 100644
--- a/pkg/gui/controllers/staging_controller.go
+++ b/pkg/gui/controllers/staging_controller.go
@@ -200,7 +200,8 @@ func (self *StagingController) applySelection(reverse bool) error {
}
if state.SelectingRange() {
- state.SetLineSelectMode()
+ firstLine, _ := state.SelectedRange()
+ state.SelectLine(firstLine)
}
return nil
diff --git a/pkg/integration/tests/commit/stage_range_of_lines.go b/pkg/integration/tests/commit/stage_range_of_lines.go
index 8c7b9c8a6..ef63b4838 100644
--- a/pkg/integration/tests/commit/stage_range_of_lines.go
+++ b/pkg/integration/tests/commit/stage_range_of_lines.go
@@ -34,9 +34,6 @@ var StageRangeOfLines = NewIntegrationTest(NewIntegrationTestArgs{
Content(
Contains(" 3rd\n 4th\n-5th\n+5th changed\n 6th"),
).
- /* EXPECTED:
SelectedLine(Equals("-5th"))
- ACTUAL */
- SelectedLine(Equals("+5th changed"))
},
})