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

Function doSelect

static/js/codemirror/codemirror.js:1597–1613  ·  view source on GitHub ↗
(cur)

Source from the content-addressed store, hash-verified

1595 var startstart = sel.from, startend = sel.to;
1596
1597 function doSelect(cur) {
1598 if (type == "single") {
1599 extendSelection(cm.doc, clipPos(doc, start), cur);
1600 return;
1601 }
1602
1603 startstart = clipPos(doc, startstart);
1604 startend = clipPos(doc, startend);
1605 if (type == "double") {
1606 var word = findWordAt(getLine(doc, cur.line).text, cur);
1607 if (posLess(cur, startstart)) extendSelection(cm.doc, word.from, startend);
1608 else extendSelection(cm.doc, startstart, word.to);
1609 } else if (type == "triple") {
1610 if (posLess(cur, startstart)) extendSelection(cm.doc, startend, clipPos(doc, Pos(cur.line, 0)));
1611 else extendSelection(cm.doc, startstart, clipPos(doc, Pos(cur.line + 1, 0)));
1612 }
1613 }
1614
1615 var editorSize = getRect(display.wrapper);
1616 // Used to ensure timeout re-tries don't fire when another extend

Callers 2

extendFunction · 0.85
doneFunction · 0.85

Calls 6

extendSelectionFunction · 0.85
clipPosFunction · 0.85
findWordAtFunction · 0.85
getLineFunction · 0.85
posLessFunction · 0.85
PosFunction · 0.85

Tested by

no test coverage detected