MCPcopy Index your code
hub / github.com/csev/py4e / setSelection

Function setSelection

tools/pythonauto/static/codemirror/codemirror.js:2592–2620  ·  view source on GitHub ↗
(doc, anchor, head, bias, checkAtomic)

Source from the content-addressed store, hash-verified

2590 // updateDoc, since they have to be expressed in the line
2591 // numbers before the update.
2592 function setSelection(doc, anchor, head, bias, checkAtomic) {
2593 if (!checkAtomic && hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) {
2594 var filtered = filterSelectionChange(doc, anchor, head);
2595 head = filtered.head;
2596 anchor = filtered.anchor;
2597 }
2598
2599 var sel = doc.sel;
2600 sel.goalColumn = null;
2601 if (bias == null) bias = posLess(head, sel.head) ? -1 : 1;
2602 // Skip over atomic spans.
2603 if (checkAtomic || !posEq(anchor, sel.anchor))
2604 anchor = skipAtomic(doc, anchor, bias, checkAtomic != "push");
2605 if (checkAtomic || !posEq(head, sel.head))
2606 head = skipAtomic(doc, head, bias, checkAtomic != "push");
2607
2608 if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;
2609
2610 sel.anchor = anchor; sel.head = head;
2611 var inv = posLess(head, anchor);
2612 sel.from = inv ? head : anchor;
2613 sel.to = inv ? anchor : head;
2614
2615 if (doc.cm)
2616 doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged =
2617 doc.cm.curOp.cursorActivity = true;
2618
2619 signalLater(doc, "cursorActivity", doc);
2620 }
2621
2622 function reCheckSelection(cm) {
2623 setSelection(cm.doc, cm.doc.sel.from, cm.doc.sel.to, null, "push");

Callers 6

onDropFunction · 0.70
extendSelectionFunction · 0.70
reCheckSelectionFunction · 0.70
indentLineFunction · 0.70
updateDocFunction · 0.70
codemirror.jsFile · 0.70

Calls 6

hasHandlerFunction · 0.70
filterSelectionChangeFunction · 0.70
posLessFunction · 0.70
posEqFunction · 0.70
skipAtomicFunction · 0.70
signalLaterFunction · 0.70

Tested by

no test coverage detected