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

Function handleKeyBinding

static/libs/codemirror.js:7120–7136  ·  view source on GitHub ↗
(cm, e)

Source from the content-addressed store, hash-verified

7118
7119// Handle a key from the keydown event.
7120function handleKeyBinding(cm, e) {
7121 var name = keyName(e, true);
7122 if (!name) { return false }
7123
7124 if (e.shiftKey && !cm.state.keySeq) {
7125 // First try to resolve full name (including 'Shift-'). Failing
7126 // that, see if there is a cursor-motion command (starting with
7127 // 'go') bound to the keyname without 'Shift-'.
7128 return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
7129 || dispatchKey(cm, name, e, function (b) {
7130 if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
7131 { return doHandleBinding(cm, b) }
7132 })
7133 } else {
7134 return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
7135 }
7136}
7137
7138// Handle a key from the keypress event
7139function handleCharBinding(cm, e, ch) {

Callers 2

onKeyDownFunction · 0.85
onKeyPressFunction · 0.85

Calls 3

keyNameFunction · 0.85
dispatchKeyFunction · 0.85
doHandleBindingFunction · 0.85

Tested by

no test coverage detected