MCPcopy
hub / github.com/witheve/Eve / extendRange

Function extendRange

src/codemirror.js:2121–2137  ·  view source on GitHub ↗
(doc, range, head, other)

Source from the content-addressed store, hash-verified

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

Callers 3

extendSelectionFunction · 0.85
extendSelectionsFunction · 0.85
leftButtonSelectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected