MCPcopy Create free account
hub / github.com/breck7/scroll / onKeyDown

Function onKeyDown

external/.scrollLibs.js:9863–9888  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

9861
9862 var lastStoppedKey = null
9863 function onKeyDown(e) {
9864 var cm = this
9865 cm.curOp.focus = activeElt()
9866 if (signalDOMEvent(cm, e)) {
9867 return
9868 }
9869 // IE does strange things with escape.
9870 if (ie && ie_version < 11 && e.keyCode == 27) {
9871 e.returnValue = false
9872 }
9873 var code = e.keyCode
9874 cm.display.shift = code == 16 || e.shiftKey
9875 var handled = handleKeyBinding(cm, e)
9876 if (presto) {
9877 lastStoppedKey = handled ? code : null
9878 // Opera has no cut event... we try to at least catch the key combo
9879 if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) {
9880 cm.replaceSelection("", null, "cut")
9881 }
9882 }
9883
9884 // Turn mouse into crosshair when Alt is held on Mac.
9885 if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)) {
9886 showCrossHair(cm)
9887 }
9888 }
9889
9890 function showCrossHair(cm) {
9891 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