(cm, e)
| 2967 | var maybeTransition; |
| 2968 | // Handle a key from the keydown event. |
| 2969 | function handleKeyBinding(cm, e) { |
| 2970 | // Handle automatic keymap transitions |
| 2971 | var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto; |
| 2972 | clearTimeout(maybeTransition); |
| 2973 | if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() { |
| 2974 | if (getKeyMap(cm.options.keyMap) == startMap) { |
| 2975 | cm.options.keyMap = (next.call ? next.call(null, cm) : next); |
| 2976 | keyMapChanged(cm); |
| 2977 | } |
| 2978 | }, 50); |
| 2979 | |
| 2980 | var name = keyName(e, true), handled = false; |
| 2981 | if (!name) return false; |
| 2982 | var keymaps = allKeyMaps(cm); |
| 2983 | |
| 2984 | if (e.shiftKey) { |
| 2985 | // First try to resolve full name (including 'Shift-'). Failing |
| 2986 | // that, see if there is a cursor-motion command (starting with |
| 2987 | // 'go') bound to the keyname without 'Shift-'. |
| 2988 | handled = lookupKey("Shift-" + name, keymaps, function(b) {return doHandleBinding(cm, b, true);}) |
| 2989 | || lookupKey(name, keymaps, function(b) { |
| 2990 | if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) |
| 2991 | return doHandleBinding(cm, b); |
| 2992 | }); |
| 2993 | } else { |
| 2994 | handled = lookupKey(name, keymaps, function(b) { return doHandleBinding(cm, b); }); |
| 2995 | } |
| 2996 | |
| 2997 | if (handled) { |
| 2998 | e_preventDefault(e); |
| 2999 | restartBlink(cm); |
| 3000 | signalLater(cm, "keyHandled", cm, name, e); |
| 3001 | } |
| 3002 | return handled; |
| 3003 | } |
| 3004 | |
| 3005 | // Handle a key from the keypress event |
| 3006 | function handleCharBinding(cm, e, ch) { |
no test coverage detected