()
| 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(); } |
no test coverage detected