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

Function heightAtLine

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:2971–2984  ·  view source on GitHub ↗
(chunk, n)

Source from the content-addressed store, hash-verified

2969 return n + i;
2970 }
2971 function heightAtLine(chunk, n) {
2972 var h = 0;
2973 outer: do {
2974 for (var i = 0, e = chunk.children.length; i < e; ++i) {
2975 var child = chunk.children[i], sz = child.chunkSize();
2976 if (n < sz) { chunk = child; continue outer; }
2977 n -= sz;
2978 h += child.height;
2979 }
2980 return h;
2981 } while (!chunk.lines);
2982 for (var i = 0; i < n; ++i) h += chunk.lines[i].height;
2983 return h;
2984 }
2985
2986 // The history object 'chunks' changes that are made close together
2987 // and at almost the same time into bigger undoable units.

Callers 3

updateDisplayFunction · 0.70
localCoordsFunction · 0.70
coordsCharFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected