mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
In vim command-mode, only eat insertion keys, not other modifiers
This commit is contained in:
@@ -14,12 +14,18 @@ describe "VimMode", ->
|
||||
expect(editor).toHaveClass 'command-mode'
|
||||
|
||||
describe "command-mode", ->
|
||||
it "stops propagation on key events that don't have bindings so that they don't get inserted", ->
|
||||
it "stops propagation on key events would otherwise insert a character, but allows unhandled non-insertions through", ->
|
||||
event = keydownEvent('\\')
|
||||
spyOn(event, 'stopPropagation')
|
||||
editor.trigger event
|
||||
expect(event.stopPropagation).toHaveBeenCalled()
|
||||
|
||||
event = keydownEvent('s', metaKey: true)
|
||||
spyOn(event, 'stopPropagation')
|
||||
editor.trigger event
|
||||
expect(event.stopPropagation).not.toHaveBeenCalled()
|
||||
|
||||
|
||||
describe "the i keybinding", ->
|
||||
it "puts the editor into insert mode", ->
|
||||
expect(editor).not.toHaveClass 'insert-mode'
|
||||
|
||||
@@ -18,9 +18,9 @@ class VimMode
|
||||
|
||||
setupCommandMode: ->
|
||||
atom.bindKeys '.command-mode', (e) ->
|
||||
if e.keystroke.match /\d/
|
||||
if e.keystroke.match /^\d$/
|
||||
return 'command-mode:numeric-prefix'
|
||||
if e.keystroke.match /./
|
||||
if e.keystroke.match /^.$/
|
||||
return false
|
||||
|
||||
@bindCommandModeKeys
|
||||
|
||||
Reference in New Issue
Block a user