Skip to content

Commit

Permalink
stop macro once motions fail
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Oct 18, 2016
1 parent 86b058d commit da8c437
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1320,13 +1320,18 @@ export class ModeHandler implements vscode.Disposable {
recordedState.actionsRun = actions.slice(0, ++i);
vimState = await this.runAction(vimState, recordedState, action);

if (vimState.lastMovementFailed) {
break;
}

await this.updateView(vimState, true);
}

vimState.isRunningDotCommand = false;
vimState.cursorPositionJustBeforeAnythingHappened = vimState.allCursors.map(x => x.stop);
return vimState;
}

public async updateView(vimState: VimState, drawSelection = true): Promise<void> {
// Draw selection (or cursor)

Expand Down
3 changes: 2 additions & 1 deletion test/mode/normalModeTests/dot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ suite("Dot Operator", () => {
let modeHandler: ModeHandler = new ModeHandler();

let {
newTest
newTest,
newTestOnly
} = getTestingFunctions(modeHandler);

setup(async () => {
Expand Down
1 change: 0 additions & 1 deletion test/testSimplifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ async function testIt(modeHandler: ModeHandler, testObj: ITestObject): Promise<v
//
let actualPosition = Position.FromVSCodePosition(TextEditor.getSelection().start);
let expectedPosition = helper.endPosition;

assert.equal(actualPosition.line, expectedPosition.line, "Cursor LINE position is wrong.");
assert.equal(actualPosition.character, expectedPosition.character, "Cursor CHARACTER position is wrong.");

Expand Down

0 comments on commit da8c437

Please sign in to comment.