diff --git a/src/api/selections.ts b/src/api/selections.ts index 707175f..49bd559 100644 --- a/src/api/selections.ts +++ b/src/api/selections.ts @@ -1401,6 +1401,7 @@ export function shift( position: vscode.Position, shift: Shift, context = Context.current, + skipCharacter: boolean = false, ) { let anchor = shift === Shift.Jump ? position @@ -1408,9 +1409,17 @@ export function shift( ? selection.active : selection.anchor; - if (context.selectionBehavior === SelectionBehavior.Character && shift !== Shift.Jump) { - const direction = anchor.isAfter(position) ? Direction.Backward : Direction.Forward; + const direction = anchor.isAfter(position) ? Direction.Backward : Direction.Forward; + + if (skipCharacter) { + if (direction === Direction.Forward) { + anchor = Positions.next(anchor) ?? anchor; + } else { + anchor = Positions.previous(anchor) ?? anchor; + } + } + if (context.selectionBehavior === SelectionBehavior.Character && shift !== Shift.Jump) { anchor = seekFrom(selection, direction, anchor, context); } diff --git a/src/commands/README.md b/src/commands/README.md index ba3b9ac..7c7f13e 100644 --- a/src/commands/README.md +++ b/src/commands/README.md @@ -124,11 +124,11 @@ selections are empty
seek.included.backwardAlt+F (editorTextFocus && dance.mode == 'normal')Shift+F (editorTextFocus && dance.mode == 'normal')seek.included.extendShift+F (editorTextFocus && dance.mode == 'normal')F (editorTextFocus && dance.mode == 'select')seek.included.extend.backwardShift+Alt+F (editorTextFocus && dance.mode == 'normal')Shift+F (editorTextFocus && dance.mode == 'select')seek.leap.backwardseek.syntax.child.experimentalseek.syntax.next.experimentalseek.syntax.parent.experimentalseek.syntax.previous.experimentalseek.leap.backwardseek.syntax.child.experimentalseek.syntax.next.experimentalseek.syntax.parent.experimentalseek.syntax.previous.experimentalseek.word.backwardB (editorTextFocus && dance.mode == 'normal')seek.word.extendShift+W (editorTextFocus && dance.mode == 'normal')W (editorTextFocus && dance.mode == 'select')seek.word.extend.backwardShift+B (editorTextFocus && dance.mode == 'normal')B (editorTextFocus && dance.mode == 'select')seek.wordEnd.extendShift+E (editorTextFocus && dance.mode == 'normal')E (editorTextFocus && dance.mode == 'select')seek.wordEnd.wsAlt+E (editorTextFocus && dance.mode == 'normal')Shift+E (editorTextFocus && dance.mode == 'normal')seek.wordEnd.ws.extendShift+Alt+E (editorTextFocus && dance.mode == 'normal')Shift+E (editorTextFocus && dance.mode == 'select')seek.wordLabel.extendseek.wordLabel.extendseek.syntax.experimentalseek.wordW (editorTextFocus && dance.mode == 'normal')seek.wordLabelseek.included.backwardAlt+F (editorTextFocus && dance.mode == 'normal')Shift+F (editorTextFocus && dance.mode == 'normal')seek.included.extendShift+F (editorTextFocus && dance.mode == 'normal')F (editorTextFocus && dance.mode == 'select')seek.included.extend.backwardShift+Alt+F (editorTextFocus && dance.mode == 'normal')Shift+F (editorTextFocus && dance.mode == 'select')seek.leap.backwardseek.syntax.child.experimentalseek.syntax.next.experimentalseek.syntax.parent.experimentalseek.syntax.previous.experimentalseek.leap.backwardseek.syntax.child.experimentalseek.syntax.next.experimentalseek.syntax.parent.experimentalseek.syntax.previous.experimentalseek.word.backwardB (editorTextFocus && dance.mode == 'normal')seek.word.extendShift+W (editorTextFocus && dance.mode == 'normal')W (editorTextFocus && dance.mode == 'select')seek.word.extend.backwardShift+B (editorTextFocus && dance.mode == 'normal')B (editorTextFocus && dance.mode == 'select')seek.wordEnd.extendShift+E (editorTextFocus && dance.mode == 'normal')E (editorTextFocus && dance.mode == 'select')seek.wordEnd.wsAlt+E (editorTextFocus && dance.mode == 'normal')Shift+E (editorTextFocus && dance.mode == 'normal')seek.wordEnd.ws.extendShift+Alt+E (editorTextFocus && dance.mode == 'normal')Shift+E (editorTextFocus && dance.mode == 'select')seek.wordLabel.extendseek.wordLabel.extendseek.syntax.experimentalseek.wordW (editorTextFocus && dance.mode == 'normal')seek.wordLabelseek.included.backwardAlt+F (editorTextFocus && dance.mode == 'normal')Shift+F (editorTextFocus && dance.mode == 'normal')seek.included.extendShift+F (editorTextFocus && dance.mode == 'normal')F (editorTextFocus && dance.mode == 'select')seek.included.extend.backwardShift+Alt+F (editorTextFocus && dance.mode == 'normal')Shift+F (editorTextFocus && dance.mode == 'select')seek.leap.backwardseek.syntax.child.experimentalseek.syntax.next.experimentalseek.syntax.parent.experimentalseek.syntax.previous.experimentalseek.leap.backwardseek.syntax.child.experimentalseek.syntax.next.experimentalseek.syntax.parent.experimentalseek.syntax.previous.experimentalseek.word.backwardB (editorTextFocus && dance.mode == 'normal')seek.word.extendShift+W (editorTextFocus && dance.mode == 'normal')W (editorTextFocus && dance.mode == 'select')seek.word.extend.backwardShift+B (editorTextFocus && dance.mode == 'normal')B (editorTextFocus && dance.mode == 'select')seek.wordEnd.extendShift+E (editorTextFocus && dance.mode == 'normal')E (editorTextFocus && dance.mode == 'select')seek.wordEnd.wsAlt+E (editorTextFocus && dance.mode == 'normal')Shift+E (editorTextFocus && dance.mode == 'normal')seek.wordEnd.ws.extendShift+Alt+E (editorTextFocus && dance.mode == 'normal')Shift+E (editorTextFocus && dance.mode == 'select')seek.wordLabel.extendseek.wordLabel.extendseek.syntax.experimentalseek.wordW (editorTextFocus && dance.mode == 'normal')seek.wordLabel