Skip to content

Commit

Permalink
Merge pull request #1413 from xconverge/fix-undo-with-arrows
Browse files Browse the repository at this point in the history
fix undo points when moving around in insert with mouse or arrow keys
  • Loading branch information
johnfn committed Mar 20, 2017
2 parents 00b293e + 25e444b commit b25008f
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -929,23 +929,16 @@ export class ModeHandler implements vscode.Disposable {

// If arrow keys or mouse was used prior to entering characters while in insert mode, create an undo point
// this needs to happen before any changes are made

/*
TODO
// If arrow keys or mouse were in insert mode, create an undo point.
// This needs to happen before any changes are made
let prevPos = vimState.historyTracker.getLastHistoryEndPosition();
if (prevPos !== undefined && !vimState.isRunningDotCommand) {
if (vimState.cursorPositionJustBeforeAnythingHappened.line !== prevPos.line ||
vimState.cursorPositionJustBeforeAnythingHappened.character !== prevPos.character) {
vimState.globalState.previousFullAction = recordedState;
vimState.historyTracker.finishCurrentStep();
if (!vimState.isMultiCursor) {
let prevPos = vimState.historyTracker.getLastHistoryEndPosition();
if (prevPos !== undefined && !vimState.isRunningDotCommand) {
if (vimState.cursorPositionJustBeforeAnythingHappened[0].line !== prevPos[0].line ||
vimState.cursorPositionJustBeforeAnythingHappened[0].character !== prevPos[0].character) {
vimState.globalState.previousFullAction = recordedState;
vimState.historyTracker.finishCurrentStep();
}
}
}
*/

if (action instanceof BaseMovement) {
({ vimState, recordedState } = await this.executeMovement(vimState, action));
Expand Down

0 comments on commit b25008f

Please sign in to comment.