MCPcopy Index your code
hub / github.com/csev/py4e / handleKeyBinding

Function handleKeyBinding

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:730–765  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

728 return true;
729 }
730 function handleKeyBinding(e) {
731 // Handle auto keymap transitions
732 var startMap = getKeyMap(options.keyMap), next = startMap.auto;
733 clearTimeout(maybeTransition);
734 if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
735 if (getKeyMap(options.keyMap) == startMap) {
736 options.keyMap = (next.call ? next.call(null, instance) : next);
737 }
738 }, 50);
739
740 var name = keyNames[e_prop(e, "keyCode")], handled = false;
741 if (name == null || e.altGraphKey) return false;
742 if (e_prop(e, "altKey")) name = "Alt-" + name;
743 if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name;
744 if (e_prop(e, "metaKey")) name = "Cmd-" + name;
745
746 var stopped = false;
747 function stop() { stopped = true; }
748
749 if (e_prop(e, "shiftKey")) {
750 handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap,
751 function(b) {return doHandleBinding(b, true);}, stop)
752 || lookupKey(name, options.extraKeys, options.keyMap, function(b) {
753 if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b);
754 }, stop);
755 } else {
756 handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);
757 }
758 if (stopped) handled = false;
759 if (handled) {
760 e_preventDefault(e);
761 restartBlink();
762 if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
763 }
764 return handled;
765 }
766 function handleCharBinding(e, ch) {
767 var handled = lookupKey("'" + ch + "'", options.extraKeys,
768 options.keyMap, function(b) { return doHandleBinding(b, true); });

Callers 2

onKeyDownFunction · 0.70
onKeyPressFunction · 0.70

Calls 7

e_propFunction · 0.85
getKeyMapFunction · 0.70
isModifierKeyFunction · 0.70
lookupKeyFunction · 0.70
doHandleBindingFunction · 0.70
e_preventDefaultFunction · 0.70
restartBlinkFunction · 0.70

Tested by

no test coverage detected