Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctrl+a and Ctrl+x now create undo points correctly and can be repeate… #636

Merged
merged 2 commits into from
Aug 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3540,14 +3540,13 @@ class ToggleCaseAndMoveForward extends BaseMovement {
}
}

abstract class IncrementDecrementNumberAction extends BaseMovement {
abstract class IncrementDecrementNumberAction extends BaseCommand {
modes = [ModeName.Normal];
canBePrefixedWithCount = true;
canBeRepeatedWithDot = true;

offset: number;

public async execActionWithCount(position: Position, vimState: VimState, count: number): Promise<Position> {
count = count || 1;
public async exec(position: Position, vimState: VimState): Promise<VimState> {
const text = TextEditor.getLineAt(position).text;

for (let { start, end, word } of Position.IterateWords(position.getWordLeft(true))) {
Expand All @@ -3560,11 +3559,12 @@ abstract class IncrementDecrementNumberAction extends BaseMovement {
const num = NumericString.parse(word);

if (num !== null) {
return this.replaceNum(num, this.offset * count, start, end);
vimState.cursorPosition = await this.replaceNum(num, this.offset * (vimState.recordedState.count || 1), start, end);
return vimState;
}
}
// No usable numbers, return the original position
return position;
return vimState;
}

public async replaceNum(start: NumericString, offset: number, startPos: Position, endPos: Position): Promise<Position> {
Expand Down
1 change: 0 additions & 1 deletion src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,6 @@ export class ModeHandler implements vscode.Disposable {

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

ranAction = true;
}

Expand Down