diff --git a/lib/ace/keyboard/keybinding.js b/lib/ace/keyboard/keybinding.js index 9caa76da..02ef6992 100644 --- a/lib/ace/keyboard/keybinding.js +++ b/lib/ace/keyboard/keybinding.js @@ -86,7 +86,9 @@ var KeyBinding = function(editor) { if (!toExecute || !toExecute.command) return false; - var success = false, commands = this.$editor.commands; + + var success = false; + var commands = this.$editor.commands; // allow keyboardHandler to consume keys if (toExecute.command != "null") diff --git a/lib/ace/keyboard/state_handler.js b/lib/ace/keyboard/state_handler.js index 15d17c8c..a5bc7fbf 100644 --- a/lib/ace/keyboard/state_handler.js +++ b/lib/ace/keyboard/state_handler.js @@ -73,7 +73,7 @@ StateHandler.prototype = { }); }, - $composeBuffer: function(data, hashId, key) { + $composeBuffer: function(data, hashId, key, e) { // Initialize the data object. if (data.state == null || data.buffer == null) { data.state = "start"; @@ -102,17 +102,23 @@ StateHandler.prototype = { data.buffer = bufferToUse; } - return { - bufferToUse: bufferToUse, - symbolicName: symbolicName + var bufferObj = { + bufferToUse: bufferToUse, + symbolicName: symbolicName, }; + + if (e) { + bufferObj.keyIdentifier = e.keyIdentifier + } + + return bufferObj; }, - $find: function(data, buffer, symbolicName, hashId, key) { + $find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) { // Holds the command to execute and the args if a command matched. var result = {}; - // Loop over all the bindings of the keymapp until a match is found. + // Loop over all the bindings of the keymap until a match is found. this.keymapping[data.state].some(function(binding) { var match; @@ -127,7 +133,7 @@ StateHandler.prototype = { } // Check if the match function matches. - if (binding.match && !binding.match(buffer, hashId, key, symbolicName)) { + if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) { return false; } @@ -194,20 +200,21 @@ StateHandler.prototype = { /** * This function is called by keyBinding. */ - handleKeyboard: function(data, hashId, key) { + handleKeyboard: function(data, hashId, key, keyCode, e) { // If we pressed any command key but no other key, then ignore the input. // Otherwise "shift-" is added to the buffer, and later on "shift-g" - // which results in "shift-shift-g" which doesn't make senese. + // which results in "shift-shift-g" which doesn't make sense. if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) { return null; } // Compute the current value of the keyboard input buffer. - var r = this.$composeBuffer(data, hashId, key); + var r = this.$composeBuffer(data, hashId, key, e); var buffer = r.bufferToUse; var symbolicName = r.symbolicName; + var keyId = r.keyIdentifier; - r = this.$find(data, buffer, symbolicName, hashId, key); + r = this.$find(data, buffer, symbolicName, hashId, key, keyId); if (DEBUG) { console.log("KeyboardStateMapper#match", buffer, symbolicName, r); } diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js index f5f527f3..71f2c132 100644 --- a/lib/ace/layer/gutter.js +++ b/lib/ace/layer/gutter.js @@ -84,7 +84,9 @@ var Gutter = function(parentEl) { }; for (var i=0; i