MCPcopy
hub / github.com/witheve/Eve / lineAtHeight

Function lineAtHeight

src/codemirror.js:7849–7866  ·  view source on GitHub ↗
(chunk, h)

Source from the content-addressed store, hash-verified

7847 // Find the line at the given vertical position, using the height
7848 // information in the document tree.
7849 function lineAtHeight(chunk, h) {
7850 var n = chunk.first;
7851 outer: do {
7852 for (var i = 0; i < chunk.children.length; ++i) {
7853 var child = chunk.children[i], ch = child.height;
7854 if (h < ch) { chunk = child; continue outer; }
7855 h -= ch;
7856 n += child.chunkSize();
7857 }
7858 return n;
7859 } while (!chunk.lines);
7860 for (var i = 0; i < chunk.lines.length; ++i) {
7861 var line = chunk.lines[i], lh = line.height;
7862 if (h < lh) break;
7863 h -= lh;
7864 }
7865 return n + i;
7866 }
7867
7868
7869 // Find the height above the given line.

Callers 4

visibleLinesFunction · 0.85
coordsCharFunction · 0.85
gutterEventFunction · 0.85
codemirror.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected