(doc, range, head, other)
| 2119 | // Otherwise, simply returns the range between the given positions. |
| 2120 | // Used for cursor motion and such. |
| 2121 | function extendRange(doc, range, head, other) { |
| 2122 | if (doc.cm && doc.cm.display.shift || doc.extend) { |
| 2123 | var anchor = range.anchor; |
| 2124 | if (other) { |
| 2125 | var posBefore = cmp(head, anchor) < 0; |
| 2126 | if (posBefore != (cmp(other, anchor) < 0)) { |
| 2127 | anchor = head; |
| 2128 | head = other; |
| 2129 | } else if (posBefore != (cmp(head, other) < 0)) { |
| 2130 | head = other; |
| 2131 | } |
| 2132 | } |
| 2133 | return new Range(anchor, head); |
| 2134 | } else { |
| 2135 | return new Range(other || head, head); |
| 2136 | } |
| 2137 | } |
| 2138 | |
| 2139 | // Extend the primary selection range, discard the rest. |
| 2140 | function extendSelection(doc, head, other, options) { |
no outgoing calls
no test coverage detected