File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -244,14 +244,12 @@ func (self *PatchExplorerController) HandleScrollRight() error {
244244}
245245
246246func (self * PatchExplorerController ) HandlePrevPage () error {
247- self .context .GetState ().SetLineSelectMode ()
248247 self .context .GetState ().AdjustSelectedLineIdx (- self .context .GetViewTrait ().PageDelta ())
249248
250249 return nil
251250}
252251
253252func (self * PatchExplorerController ) HandleNextPage () error {
254- self .context .GetState ().SetLineSelectMode ()
255253 self .context .GetState ().AdjustSelectedLineIdx (self .context .GetViewTrait ().PageDelta ())
256254
257255 return nil
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,6 +245,7 @@ func (s *State) CurrentLineNumber() int {
239245}
240246
241247func (s * State ) AdjustSelectedLineIdx (change int ) {
248+ s .DismissHunkSelectMode ()
242249 s .SelectLine (s .selectedLineIdx + change )
243250}
244251
@@ -255,12 +262,12 @@ func (s *State) PlainRenderSelected() string {
255262}
256263
257264func (s * State ) SelectBottom () {
258- s .SetLineSelectMode ()
265+ s .DismissHunkSelectMode ()
259266 s .SelectLine (s .patch .LineCount () - 1 )
260267}
261268
262269func (s * State ) SelectTop () {
263- s .SetLineSelectMode ()
270+ s .DismissHunkSelectMode ()
264271 s .SelectLine (0 )
265272}
266273
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