MCPcopy Create free account
hub / github.com/TruthHun/BookStack / extendRange

Function extendRange

static/mergely/lib/codemirror.js:2116–2132  ·  view source on GitHub ↗
(doc, range, head, other)

Source from the content-addressed store, hash-verified

2114 // Otherwise, simply returns the range between the given positions.
2115 // Used for cursor motion and such.
2116 function extendRange(doc, range, head, other) {
2117 if (doc.cm && doc.cm.display.shift || doc.extend) {
2118 var anchor = range.anchor;
2119 if (other) {
2120 var posBefore = cmp(head, anchor) < 0;
2121 if (posBefore != (cmp(other, anchor) < 0)) {
2122 anchor = head;
2123 head = other;
2124 } else if (posBefore != (cmp(head, other) < 0)) {
2125 head = other;
2126 }
2127 }
2128 return new Range(anchor, head);
2129 } else {
2130 return new Range(other || head, head);
2131 }
2132 }
2133
2134 // Extend the primary selection range, discard the rest.
2135 function extendSelection(doc, head, other, options) {

Callers 3

extendSelectionFunction · 0.70
extendSelectionsFunction · 0.70
leftButtonSelectFunction · 0.70

Calls 1

cmpFunction · 0.50

Tested by

no test coverage detected