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

Function updateLastSelection

lib/web/CodeMirror/keymap/vim.js:3160–3175  ·  view source on GitHub ↗
(cm, vim)

Source from the content-addressed store, hash-verified

3158 // Updates the previous selection with the current selection's values. This
3159 // should only be called in visual mode.
3160 function updateLastSelection(cm, vim) {
3161 var anchor = vim.sel.anchor;
3162 var head = vim.sel.head;
3163 // To accommodate the effect of lastPastedText in the last selection
3164 if (vim.lastPastedText) {
3165 head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);
3166 vim.lastPastedText = null;
3167 }
3168 vim.lastSelection = {'anchorMark': cm.setBookmark(anchor),
3169 'headMark': cm.setBookmark(head),
3170 'anchor': copyCursor(anchor),
3171 'head': copyCursor(head),
3172 'visualMode': vim.visualMode,
3173 'visualLine': vim.visualLine,
3174 'visualBlock': vim.visualBlock};
3175 }
3176 function expandSelection(cm, start, end) {
3177 var sel = cm.state.vim.sel;
3178 var head = sel.head;

Callers 2

VimFunction · 0.85
exitVisualModeFunction · 0.85

Calls 1

copyCursorFunction · 0.70

Tested by

no test coverage detected