Skip to content

Commit

Permalink
Add test cases for numeric C
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Jun 27, 2016
1 parent 3f0f7d4 commit 07b6872
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -958,12 +958,12 @@ class CommandDeleteToLineEnd extends BaseCommand {
class CommandChangeToLineEnd extends BaseCommand {
modes = [ModeName.Normal];
keys = ["C"];
canBePrefixedWithCount = true;
canBePrefixedWithCount = true;

public async exec(position: Position, vimState: VimState): Promise<VimState> {
return new ChangeOperator().run(vimState, position, position.getLineEnd().getLeft());
}

public async execCount(position: Position, vimState: VimState): Promise<VimState> {
let count = this.canBePrefixedWithCount ? vimState.recordedState.count || 1 : 1;
return new ChangeOperator().run(vimState, position, position.getDownByCount(Math.max(0, count - 1)).getLineEnd().getLeft());
Expand Down
8 changes: 8 additions & 0 deletions test/mode/normalModeTests/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ suite("Mode Normal", () => {
endMode: ModeName.Insert
});

newTest({
title: "Can handle 'NC'",
start: ['tex|t', 'one', 'two'],
keysPressed: '^ll2C',
end: ['te|', 'two'],
endMode: ModeName.Insert
});

newTest({
title: "Can handle 'r'",
start: ['tex|t'],
Expand Down

0 comments on commit 07b6872

Please sign in to comment.