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