MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / doHandleBinding

Function doHandleBinding

lib/web/CodeMirror/src/edit/key_events.js:14–32  ·  view source on GitHub ↗
(cm, bound, dropShift)

Source from the content-addressed store, hash-verified

12
13// Run a handler that was bound to a key.
14function doHandleBinding(cm, bound, dropShift) {
15 if (typeof bound == "string") {
16 bound = commands[bound]
17 if (!bound) return false
18 }
19 // Ensure previous input has been read, so that the handler sees a
20 // consistent view of the document
21 cm.display.input.ensurePolled()
22 let prevShift = cm.display.shift, done = false
23 try {
24 if (cm.isReadOnly()) cm.state.suppressEdits = true
25 if (dropShift) cm.display.shift = false
26 done = bound(cm) != Pass
27 } finally {
28 cm.display.shift = prevShift
29 cm.state.suppressEdits = false
30 }
31 return done
32}
33
34function lookupKeyForEditor(cm, name, handle) {
35 for (let i = 0; i < cm.state.keyMaps.length; i++) {

Callers 2

handleKeyBindingFunction · 0.70
handleCharBindingFunction · 0.70

Calls 1

ensurePolledMethod · 0.45

Tested by

no test coverage detected