MCPcopy
hub / github.com/witheve/Eve / updateCmSelection

Function updateCmSelection

src/codemirror.js:12258–12266  ·  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

12256 * If no arguments are given, it uses the current vim selection state.
12257 */
12258 function updateCmSelection(cm, sel, mode) {
12259 var vim = cm.state.vim;
12260 sel = sel || vim.sel;
12261 var mode = mode ||
12262 vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';
12263 var cmSel = makeCmSelection(cm, sel, mode);
12264 cm.setSelections(cmSel.ranges, cmSel.primary);
12265 updateFakeCursor(cm);
12266 }
12267 function makeCmSelection(cm, sel, mode, exclusive) {
12268 var head = copyCursor(sel.head);
12269 var anchor = copyCursor(sel.anchor);

Callers 1

VimFunction · 0.85

Calls 2

makeCmSelectionFunction · 0.85
updateFakeCursorFunction · 0.85

Tested by

no test coverage detected