Skip to content

Commit 6105cea

Browse files
committed
Revert "Merge pull request #764 from jacekkopecky/cancel-on-unrecognized-command"
This commit appears to break `dd` This reverts commit 346bb7b, reversing changes made to eb11d1f. Conflicts: lib/vim-state.coffee
1 parent 49373a3 commit 6105cea

File tree

3 files changed

+0
-51
lines changed

3 files changed

+0
-51
lines changed

lib/utils.coffee

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# copied from atom/atom-keymap src/helpers.coffee
2-
AtomModifierRegex = /(ctrl|alt|shift|cmd)$/
3-
41
module.exports =
52
# Public: Determines if a string should be considered linewise or character
63
#
@@ -47,7 +44,3 @@ module.exports =
4744
word: editor.getTextInBufferRange([wordStart, wordEnd])
4845
range: [wordStart, wordEnd]
4946
}
50-
51-
# copied and simplified from atom/atom-keymap src/helpers.coffee
52-
isAtomModifier: (keystroke) ->
53-
AtomModifierRegex.test(keystroke)

lib/vim-state.coffee

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ class VimState
3838
@activateVisualMode('characterwise') if @mode is 'command'
3939
, 100)
4040

41-
@subscriptions.add atom.keymaps.onDidFailToMatchBinding (e) =>
42-
return unless e.keyboardEventTarget is @editorElement
43-
return if Utils.isAtomModifier(e.keystrokes)
44-
45-
atom.keymaps.cancelPendingState()
46-
if @mode is 'operator-pending'
47-
@resetCommandMode()
48-
4941
@subscriptions.add @editor.onDidChangeCursorPosition @ensureCursorIsWithinLine
5042
@subscriptions.add @editor.onDidAddCursor @ensureCursorIsWithinLine
5143

spec/vim-state-spec.coffee

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -507,39 +507,3 @@ describe "VimState", ->
507507
keydown('`')
508508
commandModeInputKeydown('q')
509509
expect(editor.getCursorScreenPosition()).toEqual [1, 2]
510-
511-
describe "unknown key bindings", ->
512-
beforeEach ->
513-
editor.setText "line one\n line two\n"
514-
editor.setCursorBufferPosition [0, 0]
515-
516-
describe "in operator-pending mode", ->
517-
beforeEach ->
518-
keydown 'c'
519-
520-
it "cancels short pending operations on unrecognized keybinding", ->
521-
keydown 'q' #cq doesn't work, should cancel
522-
keydown 'w'
523-
expect(editor.getCursorBufferPosition()).toEqual [0, 5]
524-
expect(editor.getText()).toBe "line one\n line two\n"
525-
expect(vimState.mode).toEqual 'command'
526-
527-
it "cancels long pending operations on unrecognized keybinding", ->
528-
keydown 'i'
529-
keydown '3' #i3 is unrecognized, should cancel the whole `ci3` sequence
530-
keydown 'w'
531-
expect(editor.getCursorBufferPosition()).toEqual [0, 5]
532-
expect(editor.getText()).toBe "line one\n line two\n"
533-
expect(vimState.mode).toEqual 'command'
534-
535-
describe "in visual mode", ->
536-
beforeEach ->
537-
keydown 'v'
538-
539-
it "cancels whole unrecognized keybinding", ->
540-
keydown 'i'
541-
keydown '3' #i3 is unrecognized, should cancel the whole `i3` sequence
542-
keydown 'w'
543-
expect(editor.getCursorBufferPosition()).toEqual [0, 6]
544-
expect(editor.getSelectedText()).toBe "line o"
545-
expect(vimState.mode).toEqual 'visual'

0 commit comments

Comments
 (0)