MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / exitVisualMode

Function exitVisualMode

static/js/codemirror/keymap/vim.js:1493–1504  ·  view source on GitHub ↗
(cm, vim)

Source from the content-addressed store, hash-verified

1491 }
1492
1493 function exitVisualMode(cm, vim) {
1494 vim.visualMode = false;
1495 vim.visualLine = false;
1496 var selectionStart = cm.getCursor('anchor');
1497 var selectionEnd = cm.getCursor('head');
1498 if (!cursorEqual(selectionStart, selectionEnd)) {
1499 // Clear the selection and set the cursor only if the selection has not
1500 // already been cleared. Otherwise we risk moving the cursor somewhere
1501 // it's not supposed to be.
1502 cm.setCursor(clipCursorToContent(cm, selectionEnd));
1503 }
1504 }
1505
1506 // Remove any trailing newlines from the selection. For
1507 // example, with the caret at the start of the last word on the line,

Callers 2

VimFunction · 0.85
doReplaceFunction · 0.85

Calls 2

cursorEqualFunction · 0.85
clipCursorToContentFunction · 0.85

Tested by

no test coverage detected