|
285 | 285 | cm.off('cursorActivity', onCursorActivity); |
286 | 286 | CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); |
287 | 287 | cm.state.vim = null; |
| 288 | + if (highlightTimeout) clearTimeout(highlightTimeout); |
288 | 289 | } |
289 | 290 |
|
290 | 291 | function detachVimMap(cm, next) { |
|
322 | 323 | if (!vimKey) { |
323 | 324 | return false; |
324 | 325 | } |
325 | | - var cmd = CodeMirror.Vim.findKey(cm, vimKey); |
| 326 | + var cmd = vimApi.findKey(cm, vimKey); |
326 | 327 | if (typeof cmd == 'function') { |
327 | 328 | CodeMirror.signal(cm, 'vim-keypress', vimKey); |
328 | 329 | } |
|
877 | 878 | match = (/<\w+-.+?>|<\w+>|./).exec(keys); |
878 | 879 | key = match[0]; |
879 | 880 | keys = keys.substring(match.index + key.length); |
880 | | - CodeMirror.Vim.handleKey(cm, key, 'mapping'); |
| 881 | + vimApi.handleKey(cm, key, 'mapping'); |
881 | 882 | } |
882 | 883 | } |
883 | 884 |
|
|
965 | 966 | // clear VIM state in case it's in a bad state. |
966 | 967 | cm.state.vim = undefined; |
967 | 968 | maybeInitVimState(cm); |
968 | | - if (!CodeMirror.Vim.suppressErrorLogging) { |
| 969 | + if (!vimApi.suppressErrorLogging) { |
969 | 970 | console['log'](e); |
970 | 971 | } |
971 | 972 | throw e; |
|
4411 | 4412 | function highlightSearchMatches(cm, query) { |
4412 | 4413 | clearTimeout(highlightTimeout); |
4413 | 4414 | highlightTimeout = setTimeout(function() { |
| 4415 | + if (!cm.state.vim) return; |
4414 | 4416 | var searchState = getSearchState(cm); |
4415 | 4417 | var overlay = searchState.getOverlay(); |
4416 | 4418 | if (!overlay || query != overlay.query) { |
|
4605 | 4607 | if (command.type == 'exToKey') { |
4606 | 4608 | // Handle Ex to Key mapping. |
4607 | 4609 | for (var i = 0; i < command.toKeys.length; i++) { |
4608 | | - CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); |
| 4610 | + vimApi.handleKey(cm, command.toKeys[i], 'mapping'); |
4609 | 4611 | } |
4610 | 4612 | return; |
4611 | 4613 | } else if (command.type == 'exToEx') { |
|
5458 | 5460 | match = (/<\w+-.+?>|<\w+>|./).exec(text); |
5459 | 5461 | key = match[0]; |
5460 | 5462 | text = text.substring(match.index + key.length); |
5461 | | - CodeMirror.Vim.handleKey(cm, key, 'macro'); |
| 5463 | + vimApi.handleKey(cm, key, 'macro'); |
5462 | 5464 | if (vim.insertMode) { |
5463 | 5465 | var changes = register.insertModeChanges[imc++].changes; |
5464 | 5466 | vimGlobalState.macroModeState.lastInsertModeChanges.changes = |
|
0 commit comments