MCPcopy Create free account
hub / github.com/TextGeneratorio/text-generator.io / onKeyDown

Function onKeyDown

static/libs/codemirror.js:7144–7163  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

7142
7143var lastStoppedKey = null;
7144function onKeyDown(e) {
7145 var cm = this;
7146 cm.curOp.focus = activeElt();
7147 if (signalDOMEvent(cm, e)) { return }
7148 // IE does strange things with escape.
7149 if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
7150 var code = e.keyCode;
7151 cm.display.shift = code == 16 || e.shiftKey;
7152 var handled = handleKeyBinding(cm, e);
7153 if (presto) {
7154 lastStoppedKey = handled ? code : null;
7155 // Opera has no cut event... we try to at least catch the key combo
7156 if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
7157 { cm.replaceSelection("", null, "cut"); }
7158 }
7159
7160 // Turn mouse into crosshair when Alt is held on Mac.
7161 if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
7162 { showCrossHair(cm); }
7163}
7164
7165function showCrossHair(cm) {
7166 var lineDiv = cm.display.lineDiv;

Callers

nothing calls this directly

Calls 4

activeEltFunction · 0.85
signalDOMEventFunction · 0.85
handleKeyBindingFunction · 0.85
showCrossHairFunction · 0.85

Tested by

no test coverage detected