MCPcopy
hub / github.com/HubSpot/messenger / drawForLine

Function drawForLine

docs/welcome/lib/executr/lib/CodeMirror/codemirror.js:727–750  ·  view source on GitHub ↗
(line, fromArg, toArg, retTop)

Source from the content-addressed store, hash-verified

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);

Callers 1

updateSelectionRangeFunction · 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…