(doc, range, head, other)
| 2018 | // Otherwise, simply returns the range between the given positions. |
| 2019 | // Used for cursor motion and such. |
| 2020 | function extendRange(doc, range, head, other) { |
| 2021 | if (doc.cm && doc.cm.display.shift || doc.extend) { |
| 2022 | var anchor = range.anchor; |
| 2023 | if (other) { |
| 2024 | var posBefore = cmp(head, anchor) < 0; |
| 2025 | if (posBefore != (cmp(other, anchor) < 0)) { |
| 2026 | anchor = head; |
| 2027 | head = other; |
| 2028 | } else if (posBefore != (cmp(head, other) < 0)) { |
| 2029 | head = other; |
| 2030 | } |
| 2031 | } |
| 2032 | return new Range(anchor, head); |
| 2033 | } else { |
| 2034 | return new Range(other || head, head); |
| 2035 | } |
| 2036 | } |
| 2037 | |
| 2038 | // Extend the primary selection range, discard the rest. |
| 2039 | function extendSelection(doc, head, other, options) { |
no test coverage detected