(line, fromArg, toArg)
| 832 | } |
| 833 | |
| 834 | function drawForLine(line, fromArg, toArg) { |
| 835 | var lineObj = getLine(doc, line); |
| 836 | var lineLen = lineObj.text.length; |
| 837 | var start, end; |
| 838 | function coords(ch, bias) { |
| 839 | return charCoords(cm, Pos(line, ch), "div", lineObj, bias); |
| 840 | } |
| 841 | |
| 842 | iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) { |
| 843 | var leftPos = coords(from, "left"), rightPos, left, right; |
| 844 | if (from == to) { |
| 845 | rightPos = leftPos; |
| 846 | left = right = leftPos.left; |
| 847 | } else { |
| 848 | rightPos = coords(to - 1, "right"); |
| 849 | if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; } |
| 850 | left = leftPos.left; |
| 851 | right = rightPos.right; |
| 852 | } |
| 853 | if (fromArg == null && from == 0) left = leftSide; |
| 854 | if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part |
| 855 | add(left, leftPos.top, null, leftPos.bottom); |
| 856 | left = leftSide; |
| 857 | if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top); |
| 858 | } |
| 859 | if (toArg == null && to == lineLen) right = rightSide; |
| 860 | if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) |
| 861 | start = leftPos; |
| 862 | if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) |
| 863 | end = rightPos; |
| 864 | if (left < leftSide + 1) left = leftSide; |
| 865 | add(left, rightPos.top, right - left, rightPos.bottom); |
| 866 | }); |
| 867 | return {start: start, end: end}; |
| 868 | } |
| 869 | |
| 870 | if (sel.from.line == sel.to.line) { |
| 871 | drawForLine(sel.from.line, sel.from.ch, sel.to.ch); |
no test coverage detected