MCPcopy Index your code
hub / github.com/witheve/Eve / drawForLine

Function drawForLine

src/codemirror.js:2364–2398  ·  view source on GitHub ↗
(line, fromArg, toArg)

Source from the content-addressed store, hash-verified

2362 }
2363
2364 function drawForLine(line, fromArg, toArg) {
2365 var lineObj = getLine(doc, line);
2366 var lineLen = lineObj.text.length;
2367 var start, end;
2368 function coords(ch, bias) {
2369 return charCoords(cm, Pos(line, ch), "div", lineObj, bias);
2370 }
2371
2372 iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
2373 var leftPos = coords(from, "left"), rightPos, left, right;
2374 if (from == to) {
2375 rightPos = leftPos;
2376 left = right = leftPos.left;
2377 } else {
2378 rightPos = coords(to - 1, "right");
2379 if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
2380 left = leftPos.left;
2381 right = rightPos.right;
2382 }
2383 if (fromArg == null && from == 0) left = leftSide;
2384 if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
2385 add(left, leftPos.top, null, leftPos.bottom);
2386 left = leftSide;
2387 if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
2388 }
2389 if (toArg == null && to == lineLen) right = rightSide;
2390 if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
2391 start = leftPos;
2392 if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
2393 end = rightPos;
2394 if (left < leftSide + 1) left = leftSide;
2395 add(left, rightPos.top, right - left, rightPos.bottom);
2396 });
2397 return {start: start, end: end};
2398 }
2399
2400 var sFrom = range.from(), sTo = range.to();
2401 if (sFrom.line == sTo.line) {

Callers 1

drawSelectionRangeFunction · 0.85

Calls 5

getLineFunction · 0.85
iterateBidiSectionsFunction · 0.85
getOrderFunction · 0.85
coordsFunction · 0.85
addFunction · 0.70

Tested by

no test coverage detected