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

Function handleKeyEvent_

static/js/codemirror/keymap/vim.js:2504–2520  ·  view source on GitHub ↗
(cm, key, modifier)

Source from the content-addressed store, hash-verified

2502 */
2503 // TODO: Figure out a way to catch capslock.
2504 function handleKeyEvent_(cm, key, modifier) {
2505 if (isUpperCase(key)) {
2506 // Convert to lower case if shift is not the modifier since the key
2507 // we get from CodeMirror is always upper case.
2508 if (modifier == 'Shift') {
2509 modifier = null;
2510 }
2511 else {
2512 key = key.toLowerCase();
2513 }
2514 }
2515 if (modifier) {
2516 // Vim will parse modifier+key combination as a single key.
2517 key = modifier + '-' + key;
2518 }
2519 vim.handleKey(cm, key);
2520 }
2521
2522 // Closure to bind CodeMirror, key, modifier.
2523 function keyMapper(key, modifier) {

Callers 1

keyMapperFunction · 0.85

Calls 1

isUpperCaseFunction · 0.85

Tested by

no test coverage detected