(line, fromArg, toArg, retTop)
| 725 | } |
| 726 | |
| 727 | function drawForLine(line, fromArg, toArg, retTop) { |
| 728 | var lineObj = getLine(doc, line); |
| 729 | var lineLen = lineObj.text.length, rVal = retTop ? Infinity : -Infinity; |
| 730 | function coords(ch) { |
| 731 | return charCoords(cm, {line: line, ch: ch}, "div", lineObj); |
| 732 | } |
| 733 | |
| 734 | iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) { |
| 735 | var leftPos = coords(dir == "rtl" ? to - 1 : from); |
| 736 | var rightPos = coords(dir == "rtl" ? from : to - 1); |
| 737 | var left = leftPos.left, right = rightPos.right; |
| 738 | if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part |
| 739 | add(left, leftPos.top, null, leftPos.bottom); |
| 740 | left = pl; |
| 741 | if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top); |
| 742 | } |
| 743 | if (toArg == null && to == lineLen) right = clientWidth; |
| 744 | if (fromArg == null && from == 0) left = pl; |
| 745 | rVal = retTop ? Math.min(rightPos.top, rVal) : Math.max(rightPos.bottom, rVal); |
| 746 | if (left < pl + 1) left = pl; |
| 747 | add(left, rightPos.top, right - left, rightPos.bottom); |
| 748 | }); |
| 749 | return rVal; |
| 750 | } |
| 751 | |
| 752 | if (sel.from.line == sel.to.line) { |
| 753 | drawForLine(sel.from.line, sel.from.ch, sel.to.ch); |
no test coverage detected
searching dependent graphs…