(range, head, other, extend)
| 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) { |
no test coverage detected