diff --git a/lib/ace/keyboard/hash_handler.js b/lib/ace/keyboard/hash_handler.js index 9f0d7128..e56b0b13 100644 --- a/lib/ace/keyboard/hash_handler.js +++ b/lib/ace/keyboard/hash_handler.js @@ -121,10 +121,14 @@ function HashHandler(config, platform) { var key = typeof binding == "string" ? binding: binding[this.platform]; this.bindKey(key, command); }; - - // accepts keys in the form ctrl+Enter or ctrl-Enter - // keys without modifiers or shift only + + // accepts keys in the form ctrl+Enter or ctrl-Enter + // keys without modifiers or shift only this.parseKeys = function(keys) { + // todo support keychains + if (keys.indexOf(" ") != -1) + keys = keys.split(/\s+/).pop(); + var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x}); var key = parts.pop(); @@ -139,8 +143,11 @@ function HashHandler(config, platform) { var hashId = 0; for (var i = parts.length; i--;) { var modifier = keyUtil.KEY_MODS[parts[i]]; - if (modifier == null) - throw "invalid modifier " + parts[i] + " in " + keys; + if (modifier == null) { + if (typeof console != "undefined") + console.error("invalid modifier " + parts[i] + " in " + keys); + return false; + } hashId |= modifier; } return {key: key, hashId: hashId};