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

Function handleKeyNonInsertMode

lib/web/CodeMirror/keymap/vim.js:940–960  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

938 }
939
940 function handleKeyNonInsertMode() {
941 if (handleMacroRecording() || handleEsc()) { return true; }
942
943 var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;
944 if (/^[1-9]\d*$/.test(keys)) { return true; }
945
946 var keysMatcher = /^(\d*)(.*)$/.exec(keys);
947 if (!keysMatcher) { clearInputState(cm); return false; }
948 var context = vim.visualMode ? 'visual' :
949 'normal';
950 var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context);
951 if (match.type == 'none') { clearInputState(cm); return false; }
952 else if (match.type == 'partial') { return true; }
953
954 vim.inputState.keyBuffer = '';
955 var keysMatcher = /^(\d*)(.*)$/.exec(keys);
956 if (keysMatcher[1] && keysMatcher[1] != '0') {
957 vim.inputState.pushRepeatDigit(keysMatcher[1]);
958 }
959 return match.command;
960 }
961
962 var command;
963 if (vim.insertMode) { command = handleKeyInsertMode(); }

Callers 1

VimFunction · 0.85

Calls 5

handleMacroRecordingFunction · 0.85
handleEscFunction · 0.85
clearInputStateFunction · 0.85
execMethod · 0.65
testMethod · 0.45

Tested by

no test coverage detected