MCPcopy
hub / github.com/csev/py4e / lineAtHeight

Function lineAtHeight

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:2953–2970  ·  view source on GitHub ↗
(chunk, h)

Source from the content-addressed store, hash-verified

2951 return no;
2952 }
2953 function lineAtHeight(chunk, h) {
2954 var n = 0;
2955 outer: do {
2956 for (var i = 0, e = chunk.children.length; i < e; ++i) {
2957 var child = chunk.children[i], ch = child.height;
2958 if (h < ch) { chunk = child; continue outer; }
2959 h -= ch;
2960 n += child.chunkSize();
2961 }
2962 return n;
2963 } while (!chunk.lines);
2964 for (var i = 0, e = chunk.lines.length; i < e; ++i) {
2965 var line = chunk.lines[i], lh = line.height;
2966 if (h < lh) break;
2967 h -= lh;
2968 }
2969 return n + i;
2970 }
2971 function heightAtLine(chunk, n) {
2972 var h = 0;
2973 outer: do {

Callers 2

visibleLinesFunction · 0.70
coordsCharFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected