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

Function updateCmSelection

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

* Updates the CodeMirror selection to match the provided vim selection. * If no arguments are given, it uses the current vim selection state.

(cm, sel, mode)

Source from the content-addressed store, hash-verified

3201 * If no arguments are given, it uses the current vim selection state.
3202 */
3203 function updateCmSelection(cm, sel, mode) {
3204 var vim = cm.state.vim;
3205 sel = sel || vim.sel;
3206 var mode = mode ||
3207 vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';
3208 var cmSel = makeCmSelection(cm, sel, mode);
3209 cm.setSelections(cmSel.ranges, cmSel.primary);
3210 updateFakeCursor(cm);
3211 }
3212 function makeCmSelection(cm, sel, mode, exclusive) {
3213 var head = copyCursor(sel.head);
3214 var anchor = copyCursor(sel.anchor);

Callers 1

VimFunction · 0.85

Calls 2

makeCmSelectionFunction · 0.85
updateFakeCursorFunction · 0.85

Tested by

no test coverage detected