MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / lookupKey

Function lookupKey

static/js/codemirror/codemirror.js:3217–3240  ·  view source on GitHub ↗
(name, maps, handle)

Source from the content-addressed store, hash-verified

3215 }
3216
3217 function lookupKey(name, maps, handle) {
3218 function lookup(map) {
3219 map = getKeyMap(map);
3220 var found = map[name];
3221 if (found === false) return "stop";
3222 if (found != null && handle(found)) return true;
3223 if (map.nofallthrough) return "stop";
3224
3225 var fallthrough = map.fallthrough;
3226 if (fallthrough == null) return false;
3227 if (Object.prototype.toString.call(fallthrough) != "[object Array]")
3228 return lookup(fallthrough);
3229 for (var i = 0, e = fallthrough.length; i < e; ++i) {
3230 var done = lookup(fallthrough[i]);
3231 if (done) return done;
3232 }
3233 return false;
3234 }
3235
3236 for (var i = 0; i < maps.length; ++i) {
3237 var done = lookup(maps[i]);
3238 if (done) return done;
3239 }
3240 }
3241 function isModifierKey(event) {
3242 var name = keyNames[event.keyCode];
3243 return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";

Callers 2

handleKeyBindingFunction · 0.85
handleCharBindingFunction · 0.85

Calls 1

lookupFunction · 0.85

Tested by

no test coverage detected