(doc, range, head, other)
| 1046 | // Otherwise, simply returns the range between the given positions. |
| 1047 | // Used for cursor motion and such. |
| 1048 | function extendRange(doc, range, head, other) { |
| 1049 | if (doc.cm && doc.cm.display.shift || doc.extend) { |
| 1050 | var anchor = range.anchor; |
| 1051 | if (other) { |
| 1052 | var posBefore = cmp(head, anchor) < 0; |
| 1053 | if (posBefore != (cmp(other, anchor) < 0)) { |
| 1054 | anchor = head; |
| 1055 | head = other; |
| 1056 | } else if (posBefore != (cmp(head, other) < 0)) { |
| 1057 | head = other; |
| 1058 | } |
| 1059 | } |
| 1060 | return new Range(anchor, head); |
| 1061 | } else { |
| 1062 | return new Range(other || head, head); |
| 1063 | } |
| 1064 | } |
| 1065 | |
| 1066 | // Extend the primary selection range, discard the rest. |
| 1067 | function extendSelection(doc, head, other, options) { |
no test coverage detected