MCPcopy
hub / github.com/hokein/electron-sample-apps / onKeyPress

Function onKeyPress

mini-code-editor/cm/lib/codemirror.js:594–607  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

592 }
593 }
594 function onKeyPress(e) {
595 if (pollingFast) readInput();
596 if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
597 var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
598 if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
599 if (((window.opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(e)) return;
600 var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
601 if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {
602 if (mode.electricChars.indexOf(ch) > -1)
603 setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 75);
604 }
605 if (handleCharBinding(e, ch)) return;
606 fastPoll();
607 }
608 function onKeyUp(e) {
609 if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
610 if (e_prop(e, "keyCode") == 16) shiftSelecting = null;

Callers

nothing calls this directly

Calls 9

readInputFunction · 0.85
addStopFunction · 0.85
e_propFunction · 0.85
e_preventDefaultFunction · 0.85
handleKeyBindingFunction · 0.85
operationFunction · 0.85
indentLineFunction · 0.85
handleCharBindingFunction · 0.85
fastPollFunction · 0.85

Tested by

no test coverage detected