Skip to content

Commit

Permalink
tried something
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee committed May 19, 2017
1 parent cbcc982 commit 383afa1
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,20 @@ export class ModeHandler implements vscode.Disposable {
}
}

// Updated desired column
const movement = action instanceof BaseMovement ? action : undefined;

if ((movement && !movement.doesntChangeDesiredColumn) ||
(!movement && vimState.currentMode !== ModeName.VisualBlock)) {
// We check !operator here because e.g. d$ should NOT set the desired column to EOL.

if (movement && movement.setsDesiredColumnToEOL && !recordedState.operator) {
vimState.desiredColumn = Number.POSITIVE_INFINITY;
} else {
vimState.desiredColumn = vimState.cursorPosition.character;
}
}

if (ranAction) {
vimState.recordedState = new RecordedState();

Expand Down Expand Up @@ -1103,21 +1117,6 @@ export class ModeHandler implements vscode.Disposable {
this._vimState.lastVisualSelectionEnd = this._vimState.cursorPosition;
}

// Updated desired column

const movement = action instanceof BaseMovement ? action : undefined;

if ((movement && !movement.doesntChangeDesiredColumn) ||
(recordedState.command &&
vimState.currentMode !== ModeName.VisualBlock)) {
// We check !operator here because e.g. d$ should NOT set the desired column to EOL.

if (movement && movement.setsDesiredColumnToEOL && !recordedState.operator) {
vimState.desiredColumn = Number.POSITIVE_INFINITY;
} else {
vimState.desiredColumn = vimState.cursorPosition.character;
}
}

// Make sure no two cursors are at the same location.
// This is a consequence of the fact that allCursors is not a Set.
Expand Down

0 comments on commit 383afa1

Please sign in to comment.