diff --git a/src/actions/actions.ts b/src/actions/actions.ts index 169dcbcb810c..fe1a6c789dba 100644 --- a/src/actions/actions.ts +++ b/src/actions/actions.ts @@ -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 { return new ChangeOperator().run(vimState, position, position.getLineEnd().getLeft()); } - + public async execCount(position: Position, vimState: VimState): Promise { let count = this.canBePrefixedWithCount ? vimState.recordedState.count || 1 : 1; return new ChangeOperator().run(vimState, position, position.getDownByCount(Math.max(0, count - 1)).getLineEnd().getLeft()); diff --git a/test/mode/normalModeTests/commands.test.ts b/test/mode/normalModeTests/commands.test.ts index 4aafb1f9d2b8..94d5f2963676 100644 --- a/test/mode/normalModeTests/commands.test.ts +++ b/test/mode/normalModeTests/commands.test.ts @@ -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'],