* Listens for any kind of cursor activity on CodeMirror.
(cm)
| 14222 | * Listens for any kind of cursor activity on CodeMirror. |
| 14223 | */ |
| 14224 | function onCursorActivity(cm) { |
| 14225 | var vim = cm.state.vim; |
| 14226 | if (vim.insertMode) { |
| 14227 | // Tracking cursor activity in insert mode (for macro support). |
| 14228 | var macroModeState = vimGlobalState.macroModeState; |
| 14229 | if (macroModeState.isPlaying) { return; } |
| 14230 | var lastChange = macroModeState.lastInsertModeChanges; |
| 14231 | if (lastChange.expectCursorActivityForChange) { |
| 14232 | lastChange.expectCursorActivityForChange = false; |
| 14233 | } else { |
| 14234 | // Cursor moved outside the context of an edit. Reset the change. |
| 14235 | lastChange.changes = []; |
| 14236 | } |
| 14237 | } else if (!cm.curOp.isVimOp) { |
| 14238 | handleExternalSelection(cm, vim); |
| 14239 | } |
| 14240 | if (vim.visualMode) { |
| 14241 | updateFakeCursor(cm); |
| 14242 | } |
| 14243 | } |
| 14244 | function updateFakeCursor(cm) { |
| 14245 | var vim = cm.state.vim; |
| 14246 | var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); |
nothing calls this directly
no test coverage detected