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

Function extendSelection

static/js/codemirror/codemirror.js:2296–2313  ·  view source on GitHub ↗
(doc, pos, other, bias)

Source from the content-addressed store, hash-verified

2294 // If shift is held, this will move the selection anchor. Otherwise,
2295 // it'll set the whole selection.
2296 function extendSelection(doc, pos, other, bias) {
2297 if (doc.sel.shift || doc.sel.extend) {
2298 var anchor = doc.sel.anchor;
2299 if (other) {
2300 var posBefore = posLess(pos, anchor);
2301 if (posBefore != posLess(other, anchor)) {
2302 anchor = pos;
2303 pos = other;
2304 } else if (posBefore != posLess(pos, other)) {
2305 pos = other;
2306 }
2307 }
2308 setSelection(doc, anchor, pos, bias);
2309 } else {
2310 setSelection(doc, pos, other || pos, bias);
2311 }
2312 if (doc.cm) doc.cm.curOp.userSelChange = true;
2313 }
2314
2315 function filterSelectionChange(doc, anchor, head) {
2316 var obj = {anchor: anchor, head: head};

Callers 4

onMouseDownFunction · 0.85
doSelectFunction · 0.85
selectLineFunction · 0.85
codemirror.jsFile · 0.85

Calls 2

posLessFunction · 0.85
setSelectionFunction · 0.85

Tested by

no test coverage detected