File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -476,13 +476,13 @@ export const selectParentSyntax: StateCommand = ({state, dispatch}) => {
476476}
477477
478478function addCursorVertically ( view : EditorView , forward : boolean ) {
479- let { state} = view , sel = state . selection
479+ let { state} = view , sel = state . selection , ranges : SelectionRange [ ] = state . selection . ranges . slice ( )
480480 for ( let range of state . selection . ranges ) {
481481 let line = state . doc . lineAt ( range . head )
482482 if ( forward ? line . to < view . state . doc . length : line . from > 0 ) for ( let cur = range ; ; ) {
483483 let next = view . moveVertically ( cur , forward )
484484 if ( next . head < line . from || next . head > line . to ) {
485- sel = sel . addRange ( next )
485+ if ( ! ranges . some ( r => r . head == next . head ) ) ranges . push ( next )
486486 break
487487 } else if ( next . head == cur . head ) {
488488 break
@@ -491,8 +491,8 @@ function addCursorVertically(view: EditorView, forward: boolean) {
491491 }
492492 }
493493 }
494- if ( sel == state . selection ) return false
495- view . dispatch ( setSel ( view . state , sel ) )
494+ if ( ranges . length == sel . ranges . length ) return false
495+ view . dispatch ( setSel ( state , EditorSelection . create ( ranges , ranges . length - 1 ) ) )
496496 return true
497497}
498498
You can’t perform that action at this time.
0 commit comments