* Listens for any kind of cursor activity on CodeMirror.
(cm)
| 5505 | * Listens for any kind of cursor activity on CodeMirror. |
| 5506 | */ |
| 5507 | function onCursorActivity(cm) { |
| 5508 | var vim = cm.state.vim; |
| 5509 | if (vim.insertMode) { |
| 5510 | // Tracking cursor activity in insert mode (for macro support). |
| 5511 | var macroModeState = vimGlobalState.macroModeState; |
| 5512 | if (macroModeState.isPlaying) { return; } |
| 5513 | var lastChange = macroModeState.lastInsertModeChanges; |
| 5514 | if (lastChange.expectCursorActivityForChange) { |
| 5515 | lastChange.expectCursorActivityForChange = false; |
| 5516 | } else { |
| 5517 | // Cursor moved outside the context of an edit. Reset the change. |
| 5518 | lastChange.maybeReset = true; |
| 5519 | } |
| 5520 | } else if (!cm.curOp.isVimOp) { |
| 5521 | handleExternalSelection(cm, vim); |
| 5522 | } |
| 5523 | if (vim.visualMode) { |
| 5524 | updateFakeCursor(cm); |
| 5525 | } |
| 5526 | } |
| 5527 | /** |
| 5528 | * Keeps track of a fake cursor to support visual mode cursor behavior. |
| 5529 | */ |
nothing calls this directly
no test coverage detected