(cm, e)
| 2998 | var maybeTransition; |
| 2999 | // Handle a key from the keydown event. |
| 3000 | function handleKeyBinding(cm, e) { |
| 3001 | // Handle automatic keymap transitions |
| 3002 | var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto; |
| 3003 | clearTimeout(maybeTransition); |
| 3004 | if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() { |
| 3005 | if (getKeyMap(cm.options.keyMap) == startMap) { |
| 3006 | cm.options.keyMap = (next.call ? next.call(null, cm) : next); |
| 3007 | keyMapChanged(cm); |
| 3008 | } |
| 3009 | }, 50); |
| 3010 | |
| 3011 | var name = keyName(e, true), handled = false; |
| 3012 | if (!name) return false; |
| 3013 | var keymaps = allKeyMaps(cm); |
| 3014 | |
| 3015 | if (e.shiftKey) { |
| 3016 | // First try to resolve full name (including 'Shift-'). Failing |
| 3017 | // that, see if there is a cursor-motion command (starting with |
| 3018 | // 'go') bound to the keyname without 'Shift-'. |
| 3019 | handled = lookupKey("Shift-" + name, keymaps, function(b) {return doHandleBinding(cm, b, true);}) |
| 3020 | || lookupKey(name, keymaps, function(b) { |
| 3021 | if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) |
| 3022 | return doHandleBinding(cm, b); |
| 3023 | }); |
| 3024 | } else { |
| 3025 | handled = lookupKey(name, keymaps, function(b) { return doHandleBinding(cm, b); }); |
| 3026 | } |
| 3027 | |
| 3028 | if (handled) { |
| 3029 | e_preventDefault(e); |
| 3030 | restartBlink(cm); |
| 3031 | signalLater(cm, "keyHandled", cm, name, e); |
| 3032 | } |
| 3033 | return handled; |
| 3034 | } |
| 3035 | |
| 3036 | // Handle a key from the keypress event |
| 3037 | function handleCharBinding(cm, e, ch) { |
no test coverage detected
searching dependent graphs…