MCPcopy
hub / github.com/csev/py4e / onKeyDown

Function onKeyDown

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

Source from the content-addressed store, hash-verified

775
776 var lastStoppedKey = null, maybeTransition;
777 function onKeyDown(e) {
778 if (!focused) onFocus();
779 if (ie && e.keyCode == 27) { e.returnValue = false; }
780 if (pollingFast) { if (readInput()) pollingFast = false; }
781 if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
782 var code = e_prop(e, "keyCode");
783 // IE does strange things with escape.
784 setShift(code == 16 || e_prop(e, "shiftKey"));
785 // First give onKeyEvent option a chance to handle this.
786 var handled = handleKeyBinding(e);
787 if (window.opera) {
788 lastStoppedKey = handled ? code : null;
789 // Opera has no cut event... we try to at least catch the key combo
790 if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey"))
791 replaceSelection("");
792 }
793 }
794 function onKeyPress(e) {
795 if (pollingFast) readInput();
796 if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;

Callers

nothing calls this directly

Calls 7

e_propFunction · 0.85
setShiftFunction · 0.85
replaceSelectionFunction · 0.85
onFocusFunction · 0.70
readInputFunction · 0.70
addStopFunction · 0.70
handleKeyBindingFunction · 0.70

Tested by

no test coverage detected