From f983049b07165bcf50934298da7d0d9a60689ef2 Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 19 Oct 2016 14:30:51 -0700 Subject: [PATCH] fix #921 --- src/actions/actions.ts | 4 ++++ test/mode/normalModeTests/commands.test.ts | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/actions/actions.ts b/src/actions/actions.ts index 5b4ac4e9b76..04905f6ec26 100644 --- a/src/actions/actions.ts +++ b/src/actions/actions.ts @@ -2427,6 +2427,10 @@ class CommandDeleteToLineEnd extends BaseCommand { canBeRepeatedWithDot = true; public async exec(position: Position, vimState: VimState): Promise { + if (position.isLineEnd()) { + return vimState; + } + return await new DeleteOperator().run(vimState, position, position.getLineEnd().getLeft()); } } diff --git a/test/mode/normalModeTests/commands.test.ts b/test/mode/normalModeTests/commands.test.ts index 4690f9f8e88..cdccb5e11b0 100644 --- a/test/mode/normalModeTests/commands.test.ts +++ b/test/mode/normalModeTests/commands.test.ts @@ -105,6 +105,13 @@ suite("Mode Normal", () => { end: ['t|e'], }); + newTest({ + title: "Can handle 'D' on empty lines", + start: ['text', '|', 'text'], + keysPressed: 'D', + end: ['text', '|', 'text'] + }); + newTest({ title: "Can handle 'DD'", start: ['tex|t'],