MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / onCursorActivity

Function onCursorActivity

lib/web/CodeMirror/keymap/vim.js:5507–5526  ·  view source on GitHub ↗

* Listens for any kind of cursor activity on CodeMirror.

(cm)

Source from the content-addressed store, hash-verified

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 */

Callers

nothing calls this directly

Calls 2

handleExternalSelectionFunction · 0.85
updateFakeCursorFunction · 0.85

Tested by

no test coverage detected