diff --git a/spec/atom/vim-mode-spec.coffee b/spec/atom/vim-mode-spec.coffee index 10514f014..98f4278f0 100644 --- a/spec/atom/vim-mode-spec.coffee +++ b/spec/atom/vim-mode-spec.coffee @@ -48,6 +48,10 @@ describe "VimMode", -> expect(editor.buffer.getText()).toBe '0123' expect(editor.getCursorPosition()).toEqual([0, 3]) + editor.trigger keydownEvent('x') + expect(editor.buffer.getText()).toBe '012' + expect(editor.getCursorPosition()).toEqual([0, 2]) + describe "the d keybinding", -> describe "when followed by a d", -> it "deletes the current line", -> diff --git a/src/atom/vim-mode/commands.coffee b/src/atom/vim-mode/commands.coffee index 2d4978df4..aafb6e2c2 100644 --- a/src/atom/vim-mode/commands.coffee +++ b/src/atom/vim-mode/commands.coffee @@ -5,8 +5,8 @@ class Command class DeleteRight extends Command execute: -> @editor.delete() - isOnLastCharachter = @editor.getCursorColumn() == @editor.getCurrentLine().length - if isOnLastCharachter + isOnEOL = @editor.getCursorColumn() == @editor.getCurrentLine().length + if isOnEOL @editor.setCursorColumn(@editor.getCursorColumn() - 1) module.exports = { DeleteRight }