(line, fromArg, toArg)
| 1287 | } |
| 1288 | |
| 1289 | function drawForLine(line, fromArg, toArg) { |
| 1290 | var lineObj = getLine(doc, line); |
| 1291 | var lineLen = lineObj.text.length; |
| 1292 | var start, end; |
| 1293 | function coords(ch, bias) { |
| 1294 | return charCoords(cm, Pos(line, ch), "div", lineObj, bias); |
| 1295 | } |
| 1296 | |
| 1297 | iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) { |
| 1298 | var leftPos = coords(from, "left"), rightPos, left, right; |
| 1299 | if (from == to) { |
| 1300 | rightPos = leftPos; |
| 1301 | left = right = leftPos.left; |
| 1302 | } else { |
| 1303 | rightPos = coords(to - 1, "right"); |
| 1304 | if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; } |
| 1305 | left = leftPos.left; |
| 1306 | right = rightPos.right; |
| 1307 | } |
| 1308 | if (fromArg == null && from == 0) left = leftSide; |
| 1309 | if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part |
| 1310 | add(left, leftPos.top, null, leftPos.bottom); |
| 1311 | left = leftSide; |
| 1312 | if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top); |
| 1313 | } |
| 1314 | if (toArg == null && to == lineLen) right = rightSide; |
| 1315 | if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) |
| 1316 | start = leftPos; |
| 1317 | if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) |
| 1318 | end = rightPos; |
| 1319 | if (left < leftSide + 1) left = leftSide; |
| 1320 | add(left, rightPos.top, right - left, rightPos.bottom); |
| 1321 | }); |
| 1322 | return {start: start, end: end}; |
| 1323 | } |
| 1324 | |
| 1325 | var sFrom = range.from(), sTo = range.to(); |
| 1326 | if (sFrom.line == sTo.line) { |
no test coverage detected