File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,12 @@ func (s *State) SetLineSelectMode() {
123123 s .selectMode = LINE
124124}
125125
126+ func (s * State ) DismissHunkSelectMode () {
127+ if s .SelectingHunk () {
128+ s .selectMode = LINE
129+ }
130+ }
131+
126132// For when you move the cursor without holding shift (meaning if we're in
127133// a non-sticky range select, we'll cancel it)
128134func (s * State ) SelectLine (newSelectedLineIdx int ) {
@@ -239,7 +245,7 @@ func (s *State) CurrentLineNumber() int {
239245}
240246
241247func (s * State ) AdjustSelectedLineIdx (change int ) {
242- s .SetLineSelectMode ()
248+ s .DismissHunkSelectMode ()
243249 s .SelectLine (s .selectedLineIdx + change )
244250}
245251
@@ -256,12 +262,12 @@ func (s *State) PlainRenderSelected() string {
256262}
257263
258264func (s * State ) SelectBottom () {
259- s .SetLineSelectMode ()
265+ s .DismissHunkSelectMode ()
260266 s .SelectLine (s .patch .LineCount () - 1 )
261267}
262268
263269func (s * State ) SelectTop () {
264- s .SetLineSelectMode ()
270+ s .DismissHunkSelectMode ()
265271 s .SelectLine (0 )
266272}
267273
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
1414// (sticky range, press 'v') -> no range
1515// (sticky range, press 'escape') -> no range
1616// (sticky range, press arrow) -> sticky range
17+ // (sticky range, press `<`/`>` or `,`/`.`) -> sticky range
1718// (sticky range, press shift+arrow) -> nonsticky range
1819// (nonsticky range, press 'v') -> no range
1920// (nonsticky range, press 'escape') -> no range
@@ -138,19 +139,18 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
138139 SelectedLines (
139140 Contains ("line 8" ),
140141 ).
142+ // (sticky range, press '>') -> sticky range
141143 Press (keys .Universal .ToggleRangeSelect ).
142- SelectedLines (
143- Contains ("line 8" ),
144- ).
145- SelectNextItem ().
144+ Press (keys .Universal .GotoBottom ).
146145 SelectedLines (
147146 Contains ("line 8" ),
148147 Contains ("line 9" ),
148+ Contains ("line 10" ),
149149 ).
150150 // (sticky range, press 'escape') -> no range
151151 PressEscape ().
152152 SelectedLines (
153- Contains ("line 9 " ),
153+ Contains ("line 10 " ),
154154 )
155155 }
156156
You can’t perform that action at this time.
0 commit comments