From ba06c9e978953bcbe82a49de44a48cf4ac3d30d6 Mon Sep 17 00:00:00 2001 From: xconverge Date: Tue, 4 Oct 2016 20:37:08 -0700 Subject: [PATCH 1/2] Fixes arrow navigation to EOL while in insert --- src/mode/modeHandler.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mode/modeHandler.ts b/src/mode/modeHandler.ts index d9fb0d65bf8..b4fe66c3c02 100644 --- a/src/mode/modeHandler.ts +++ b/src/mode/modeHandler.ts @@ -486,7 +486,13 @@ export class ModeHandler implements vscode.Disposable { var newPosition = new Position(selection.active.line, selection.active.character); if (newPosition.character >= newPosition.getLineEnd().character) { - newPosition = new Position(newPosition.line, Math.max(newPosition.getLineEnd().character - 1, 0)); + if (this._vimState.currentMode === ModeName.Insert) { + // This lets you use arrow keys to move to the end of the line + newPosition = new Position(newPosition.line, Math.max(newPosition.getLineEnd().character, 0)); + } else { + // This prevents you from mouse clicking past the EOL + newPosition = new Position(newPosition.line, Math.max(newPosition.getLineEnd().character - 1, 0)); + } } this._vimState.cursorPosition = newPosition; From 7486dacdca72e69f50a9b624fe94788134e8f230 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Wed, 5 Oct 2016 08:45:41 -0700 Subject: [PATCH 2/2] Minor cleanup --- src/mode/modeHandler.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mode/modeHandler.ts b/src/mode/modeHandler.ts index b4fe66c3c02..105bba216ad 100644 --- a/src/mode/modeHandler.ts +++ b/src/mode/modeHandler.ts @@ -486,10 +486,7 @@ export class ModeHandler implements vscode.Disposable { var newPosition = new Position(selection.active.line, selection.active.character); if (newPosition.character >= newPosition.getLineEnd().character) { - if (this._vimState.currentMode === ModeName.Insert) { - // This lets you use arrow keys to move to the end of the line - newPosition = new Position(newPosition.line, Math.max(newPosition.getLineEnd().character, 0)); - } else { + if (this._vimState.currentMode !== ModeName.Insert) { // This prevents you from mouse clicking past the EOL newPosition = new Position(newPosition.line, Math.max(newPosition.getLineEnd().character - 1, 0)); } @@ -1306,4 +1303,4 @@ export class ModeHandler implements vscode.Disposable { dispose() { // do nothing } -} \ No newline at end of file +}