()
| 10124 | } |
| 10125 | |
| 10126 | function handleKeyNonInsertMode() { |
| 10127 | if (handleMacroRecording() || handleEsc()) { return true; }; |
| 10128 | |
| 10129 | var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; |
| 10130 | if (/^[1-9]\d*$/.test(keys)) { return true; } |
| 10131 | |
| 10132 | var keysMatcher = /^(\d*)(.*)$/.exec(keys); |
| 10133 | if (!keysMatcher) { clearInputState(cm); return false; } |
| 10134 | var context = vim.visualMode ? 'visual' : |
| 10135 | 'normal'; |
| 10136 | var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); |
| 10137 | if (match.type == 'none') { clearInputState(cm); return false; } |
| 10138 | else if (match.type == 'partial') { return true; } |
| 10139 | |
| 10140 | vim.inputState.keyBuffer = ''; |
| 10141 | var keysMatcher = /^(\d*)(.*)$/.exec(keys); |
| 10142 | if (keysMatcher[1] && keysMatcher[1] != '0') { |
| 10143 | vim.inputState.pushRepeatDigit(keysMatcher[1]); |
| 10144 | } |
| 10145 | return match.command; |
| 10146 | } |
| 10147 | |
| 10148 | var command; |
| 10149 | if (vim.insertMode) { command = handleKeyInsertMode(); } |
no test coverage detected