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

Function getLine

tools/pythonauto/static/codemirrorepl/codemirror.js:6428–6439  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

6426
6427 // Find the line object corresponding to the given line number.
6428 function getLine(doc, n) {
6429 n -= doc.first;
6430 if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document.");
6431 for (var chunk = doc; !chunk.lines;) {
6432 for (var i = 0;; ++i) {
6433 var child = chunk.children[i], sz = child.chunkSize();
6434 if (n < sz) { chunk = child; break; }
6435 n -= sz;
6436 }
6437 }
6438 return chunk.lines[n];
6439 }
6440
6441 // Get the part of a document between two positions, as an array of
6442 // strings.

Callers 15

findMaxLineFunction · 0.70
visibleLinesFunction · 0.70
updateDisplayInnerFunction · 0.70
clipPosFunction · 0.70
skipAtomicFunction · 0.70
drawForLineFunction · 0.70
drawSelectionRangeFunction · 0.70
findStartLineFunction · 0.70
getStateBeforeFunction · 0.70
charCoordsFunction · 0.70
cursorCoordsFunction · 0.70
estimateCoordsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected