|
1646 | 1646 |
|
1647 | 1647 | var rect; |
1648 | 1648 | if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates. |
1649 | | - while (start && isExtendingChar(prepared.line.text.charAt(mStart + start))) --start; |
1650 | | - while (mStart + end < mEnd && isExtendingChar(prepared.line.text.charAt(mStart + end))) ++end; |
1651 | | - if (ie && ie_version < 9 && start == 0 && end == mEnd - mStart) { |
1652 | | - rect = node.parentNode.getBoundingClientRect(); |
1653 | | - } else if (ie && cm.options.lineWrapping) { |
1654 | | - var rects = range(node, start, end).getClientRects(); |
1655 | | - if (rects.length) |
1656 | | - rect = rects[bias == "right" ? rects.length - 1 : 0]; |
1657 | | - else |
1658 | | - rect = nullRect; |
1659 | | - } else { |
1660 | | - rect = range(node, start, end).getBoundingClientRect() || nullRect; |
| 1649 | + for (;;) { |
| 1650 | + while (start && isExtendingChar(prepared.line.text.charAt(mStart + start))) --start; |
| 1651 | + while (mStart + end < mEnd && isExtendingChar(prepared.line.text.charAt(mStart + end))) ++end; |
| 1652 | + if (ie && ie_version < 9 && start == 0 && end == mEnd - mStart) { |
| 1653 | + rect = node.parentNode.getBoundingClientRect(); |
| 1654 | + } else if (ie && cm.options.lineWrapping) { |
| 1655 | + var rects = range(node, start, end).getClientRects(); |
| 1656 | + if (rects.length) |
| 1657 | + rect = rects[bias == "right" ? rects.length - 1 : 0]; |
| 1658 | + else |
| 1659 | + rect = nullRect; |
| 1660 | + } else { |
| 1661 | + rect = range(node, start, end).getBoundingClientRect() || nullRect; |
| 1662 | + } |
| 1663 | + if (rect.left || rect.right || start == 0) break; |
| 1664 | + end = start; |
| 1665 | + start = start - 1; |
| 1666 | + collapse = "right"; |
1661 | 1667 | } |
1662 | 1668 | } else { // If it is a widget, simply get the box for the whole widget. |
1663 | 1669 | if (start > 0) collapse = bias = "right"; |
|
0 commit comments