MCPcopy Create free account
hub / github.com/sql-js/sql.js / drawForLine

Function drawForLine

GUI/codemirror/lib/codemirror.js:1304–1338  ·  view source on GitHub ↗
(line, fromArg, toArg)

Source from the content-addressed store, hash-verified

1302 }
1303
1304 function drawForLine(line, fromArg, toArg) {
1305 var lineObj = getLine(doc, line);
1306 var lineLen = lineObj.text.length;
1307 var start, end;
1308 function coords(ch, bias) {
1309 return charCoords(cm, Pos(line, ch), "div", lineObj, bias);
1310 }
1311
1312 iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
1313 var leftPos = coords(from, "left"), rightPos, left, right;
1314 if (from == to) {
1315 rightPos = leftPos;
1316 left = right = leftPos.left;
1317 } else {
1318 rightPos = coords(to - 1, "right");
1319 if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
1320 left = leftPos.left;
1321 right = rightPos.right;
1322 }
1323 if (fromArg == null && from == 0) left = leftSide;
1324 if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
1325 add(left, leftPos.top, null, leftPos.bottom);
1326 left = leftSide;
1327 if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
1328 }
1329 if (toArg == null && to == lineLen) right = rightSide;
1330 if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
1331 start = leftPos;
1332 if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
1333 end = rightPos;
1334 if (left < leftSide + 1) left = leftSide;
1335 add(left, rightPos.top, right - left, rightPos.bottom);
1336 });
1337 return {start: start, end: end};
1338 }
1339
1340 var sFrom = range.from(), sTo = range.to();
1341 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…