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

Function updateLastSelection

src/codemirror.js:12215–12230  ·  view source on GitHub ↗
(cm, vim)

Source from the content-addressed store, hash-verified

12213 // Updates the previous selection with the current selection's values. This
12214 // should only be called in visual mode.
12215 function updateLastSelection(cm, vim) {
12216 var anchor = vim.sel.anchor;
12217 var head = vim.sel.head;
12218 // To accommodate the effect of lastPastedText in the last selection
12219 if (vim.lastPastedText) {
12220 head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);
12221 vim.lastPastedText = null;
12222 }
12223 vim.lastSelection = {'anchorMark': cm.setBookmark(anchor),
12224 'headMark': cm.setBookmark(head),
12225 'anchor': copyCursor(anchor),
12226 'head': copyCursor(head),
12227 'visualMode': vim.visualMode,
12228 'visualLine': vim.visualLine,
12229 'visualBlock': vim.visualBlock};
12230 }
12231 function expandSelection(cm, start, end) {
12232 var sel = cm.state.vim.sel;
12233 var head = sel.head;

Callers 2

VimFunction · 0.85
exitVisualModeFunction · 0.85

Calls 4

copyCursorFunction · 0.85
posFromIndexMethod · 0.80
indexFromPosMethod · 0.80
setBookmarkMethod · 0.80

Tested by

no test coverage detected