MCPcopy
hub / github.com/ajaxorg/ace / handleKeyNonInsertMode

Function handleKeyNonInsertMode

src/keyboard/vim.js:1776–1807  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1774 }
1775
1776 function handleKeyNonInsertMode() {
1777 if (handleMacroRecording() || handleEsc()) { return true; }
1778
1779 vim.inputState.keyBuffer.push(key);
1780 var keys = vim.inputState.keyBuffer.join("");
1781 if (/^[1-9]\d*$/.test(keys)) { return true; }
1782
1783 var keysMatcher = /^(\d*)(.*)$/.exec(keys);
1784 if (!keysMatcher) { clearInputState(cm); return false; }
1785 var context = vim.visualMode ? 'visual' :
1786 'normal';
1787 var mainKey = keysMatcher[2] || keysMatcher[1];
1788 if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) {
1789 // multikey operators act linewise by repeating only the last character
1790 mainKey = vim.inputState.operatorShortcut;
1791 }
1792 var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context);
1793 if (match.type == 'none') { clearInputState(cm); return false; }
1794 else if (match.type == 'partial') {
1795 if (match.expectLiteralNext) vim.expectLiteralNext = true;
1796 return true;
1797 }
1798 else if (match.type == 'clear') { clearInputState(cm); return true; }
1799 vim.expectLiteralNext = false;
1800
1801 vim.inputState.keyBuffer.length = 0;
1802 keysMatcher = /^(\d*)(.*)$/.exec(keys);
1803 if (keysMatcher[1] && keysMatcher[1] != '0') {
1804 vim.inputState.pushRepeatDigit(keysMatcher[1]);
1805 }
1806 return match.command;
1807 }
1808
1809 var command;
1810 if (vim.insertMode) { command = handleKeyInsertMode(); }

Callers 1

vim.jsFile · 0.85

Calls 7

handleMacroRecordingFunction · 0.85
handleEscFunction · 0.85
clearInputStateFunction · 0.85
pushMethod · 0.80
execMethod · 0.80
sliceMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…