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

Function handleKeyBinding

external/.scrollLibs.js:9828–9853  ·  view source on GitHub ↗
(cm, e)

Source from the content-addressed store, hash-verified

9826
9827 // Handle a key from the keydown event.
9828 function handleKeyBinding(cm, e) {
9829 var name = keyName(e, true)
9830 if (!name) {
9831 return false
9832 }
9833
9834 if (e.shiftKey && !cm.state.keySeq) {
9835 // First try to resolve full name (including 'Shift-'). Failing
9836 // that, see if there is a cursor-motion command (starting with
9837 // 'go') bound to the keyname without 'Shift-'.
9838 return (
9839 dispatchKey(cm, "Shift-" + name, e, function (b) {
9840 return doHandleBinding(cm, b, true)
9841 }) ||
9842 dispatchKey(cm, name, e, function (b) {
9843 if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) {
9844 return doHandleBinding(cm, b)
9845 }
9846 })
9847 )
9848 } else {
9849 return dispatchKey(cm, name, e, function (b) {
9850 return doHandleBinding(cm, b)
9851 })
9852 }
9853 }
9854
9855 // Handle a key from the keypress event
9856 function 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