MCPcopy Index your code
hub / github.com/nwutils/nw-sample-apps / heightAtLine

Function heightAtLine

mini-code-edit/cm/lib/codemirror.js:2771–2784  ·  view source on GitHub ↗
(chunk, n)

Source from the content-addressed store, hash-verified

2769 return n + i;
2770 }
2771 function heightAtLine(chunk, n) {
2772 var h = 0;
2773 outer: do {
2774 for (var i = 0, e = chunk.children.length; i < e; ++i) {
2775 var child = chunk.children[i], sz = child.chunkSize();
2776 if (n < sz) { chunk = child; continue outer; }
2777 n -= sz;
2778 h += child.height;
2779 }
2780 return h;
2781 } while (!chunk.lines);
2782 for (var i = 0; i < n; ++i) h += chunk.lines[i].height;
2783 return h;
2784 }
2785
2786 // The history object 'chunks' changes that are made close together
2787 // and at almost the same time into bigger undoable units.

Callers 3

updateDisplayFunction · 0.85
localCoordsFunction · 0.85
coordsCharFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected