MCPcopy Create free account
hub / github.com/breck7/scroll / extendRange

Function extendRange

external/.scrollLibs.js:6869–6885  ·  view source on GitHub ↗
(range, head, other, extend)

Source from the content-addressed store, hash-verified

6867 // Otherwise, simply returns the range between the given positions.
6868 // Used for cursor motion and such.
6869 function extendRange(range, head, other, extend) {
6870 if (extend) {
6871 var anchor = range.anchor
6872 if (other) {
6873 var posBefore = cmp(head, anchor) < 0
6874 if (posBefore != cmp(other, anchor) < 0) {
6875 anchor = head
6876 head = other
6877 } else if (posBefore != cmp(head, other) < 0) {
6878 head = other
6879 }
6880 }
6881 return new Range(anchor, head)
6882 } else {
6883 return new Range(other || head, head)
6884 }
6885 }
6886
6887 // Extend the primary selection range, discard the rest.
6888 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