MCPcopy
hub / github.com/DHTMLX/gantt / extendRange

Function extendRange

samples/common/codehighlight/codemirror.js:5031–5047  ·  view source on GitHub ↗
(range, head, other, extend)

Source from the content-addressed store, hash-verified

5029 // Otherwise, simply returns the range between the given positions.
5030 // Used for cursor motion and such.
5031 function extendRange(range, head, other, extend) {
5032 if (extend) {
5033 var anchor = range.anchor;
5034 if (other) {
5035 var posBefore = cmp(head, anchor) < 0;
5036 if (posBefore != (cmp(other, anchor) < 0)) {
5037 anchor = head;
5038 head = other;
5039 } else if (posBefore != (cmp(head, other) < 0)) {
5040 head = other;
5041 }
5042 }
5043 return new Range(anchor, head)
5044 } else {
5045 return new Range(other || head, head)
5046 }
5047 }
5048
5049 // Extend the primary selection range, discard the rest.
5050 function extendSelection(doc, head, other, options, extend) {

Callers 3

extendSelectionFunction · 0.85
extendSelectionsFunction · 0.85
leftButtonSelectFunction · 0.85

Calls 1

cmpFunction · 0.85

Tested by

no test coverage detected