MCPcopy Create free account
hub / github.com/sql-js/sql.js / extendRange

Function extendRange

GUI/codemirror/lib/codemirror.js:1063–1079  ·  view source on GitHub ↗
(doc, range, head, other)

Source from the content-addressed store, hash-verified

1061 // Otherwise, simply returns the range between the given positions.
1062 // Used for cursor motion and such.
1063 function extendRange(doc, range, head, other) {
1064 if (doc.cm && doc.cm.display.shift || doc.extend) {
1065 var anchor = range.anchor;
1066 if (other) {
1067 var posBefore = cmp(head, anchor) < 0;
1068 if (posBefore != (cmp(other, anchor) < 0)) {
1069 anchor = head;
1070 head = other;
1071 } else if (posBefore != (cmp(head, other) < 0)) {
1072 head = other;
1073 }
1074 }
1075 return new Range(anchor, head);
1076 } else {
1077 return new Range(other || head, head);
1078 }
1079 }
1080
1081 // Extend the primary selection range, discard the rest.
1082 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…