diff --git a/lib/ace/keyboardstate.js b/lib/ace/keyboardstate.js index c204c527..0d07b2e8 100644 --- a/lib/ace/keyboardstate.js +++ b/lib/ace/keyboardstate.js @@ -165,9 +165,11 @@ KeyboardStateMapper.prototype = { if (binding.then) { data.state = binding.then; data.buffer = ""; - if (result.command == null) { - result.command = "null"; - } + } + + // If no command is set, then execute the "null" fake command. + if (result.command == null) { + result.command = "null"; } return true; diff --git a/lib/ace/mode/vim.js b/lib/ace/mode/vim.js index 2e99538d..eb36635d 100644 --- a/lib/ace/mode/vim.js +++ b/lib/ace/mode/vim.js @@ -94,15 +94,22 @@ var vimStates = { ] }, { - comment: "Let all combos of Command, Ctrl, Optional pass...", + comment: "Catch some keyboard input to stop it here", match: function(buffer, hashId, key, symbolicName) { - return hashId != 0 && !(hashId & 4); + // If no command keys are pressed, then catch the input. + if (hashId == 0) { + return true; + } + // If only the shift key is pressed and a character key, then + // catch that input as well. + else if ((hashId == 4) && key.length == 1) { + return true; + } + // Otherwise, we let the input got through. + else { + return false; + } } - }, - { - comment: "...but stop all other input!", - key: ".*", - exec: "null" } ], insertMode: [