(pos)
| 10226 | |
| 10227 | var lastPos = start |
| 10228 | function extendTo(pos) { |
| 10229 | if (cmp(lastPos, pos) == 0) { |
| 10230 | return |
| 10231 | } |
| 10232 | lastPos = pos |
| 10233 | |
| 10234 | if (behavior.unit == "rectangle") { |
| 10235 | var ranges = [], |
| 10236 | tabSize = cm.options.tabSize |
| 10237 | var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize) |
| 10238 | var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize) |
| 10239 | var left = Math.min(startCol, posCol), |
| 10240 | right = Math.max(startCol, posCol) |
| 10241 | for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); line <= end; line++) { |
| 10242 | var text = getLine(doc, line).text, |
| 10243 | leftPos = findColumn(text, left, tabSize) |
| 10244 | if (left == right) { |
| 10245 | ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) |
| 10246 | } else if (text.length > leftPos) { |
| 10247 | ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) |
| 10248 | } |
| 10249 | } |
| 10250 | if (!ranges.length) { |
| 10251 | ranges.push(new Range(start, start)) |
| 10252 | } |
| 10253 | setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), { origin: "*mouse", scroll: false }) |
| 10254 | cm.scrollIntoView(pos) |
| 10255 | } else { |
| 10256 | var oldRange = ourRange |
| 10257 | var range$$1 = rangeForUnit(cm, pos, behavior.unit) |
| 10258 | var anchor = oldRange.anchor, |
| 10259 | head |
| 10260 | if (cmp(range$$1.anchor, anchor) > 0) { |
| 10261 | head = range$$1.head |
| 10262 | anchor = minPos(oldRange.from(), range$$1.anchor) |
| 10263 | } else { |
| 10264 | head = range$$1.anchor |
| 10265 | anchor = maxPos(oldRange.to(), range$$1.head) |
| 10266 | } |
| 10267 | var ranges$1 = startSel.ranges.slice(0) |
| 10268 | ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head)) |
| 10269 | setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse) |
| 10270 | } |
| 10271 | } |
| 10272 | |
| 10273 | var editorSize = display.wrapper.getBoundingClientRect() |
| 10274 | // Used to ensure timeout re-tries don't fire when another extend |
no test coverage detected