diff --git a/src/motion/motion.ts b/src/motion/motion.ts index 68446656f53..48e465dbcab 100644 --- a/src/motion/motion.ts +++ b/src/motion/motion.ts @@ -60,7 +60,13 @@ export class Motion implements vscode.Disposable { let line = selection.active.line; let char = selection.active.character; - this.position = new Position(line, char, null); + var newPosition = new Position(line, char, this._position.positionOptions); + + if (char > newPosition.getLineEnd().character) { + newPosition = new Position(newPosition.line, newPosition.getLineEnd().character, null); + } + + this.position = newPosition; this._desiredColumn = this.position.character; this.changeMode(this._motionMode); } @@ -103,11 +109,6 @@ export class Motion implements vscode.Disposable { // Valid Positions for Caret: [0, eol) this._position.positionOptions = PositionOptions.CharacterWiseExclusive; - if (this.position.character > this._position.getLineEnd().character) { - this._position = this._position.getLineEnd(); - this._desiredColumn = this._position.character; - } - this.highlightBlock(this.position); break;