MCPcopy
hub / github.com/pandao/editor.md / getLine

Function getLine

lib/codemirror/lib/codemirror.js:7530–7541  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

7528
7529 // Find the line object corresponding to the given line number.
7530 function getLine(doc, n) {
7531 n -= doc.first;
7532 if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document.");
7533 for (var chunk = doc; !chunk.lines;) {
7534 for (var i = 0;; ++i) {
7535 var child = chunk.children[i], sz = child.chunkSize();
7536 if (n < sz) { chunk = child; break; }
7537 n -= sz;
7538 }
7539 }
7540 return chunk.lines[n];
7541 }
7542
7543 // Get the part of a document between two positions, as an array of
7544 // strings.

Callers 15

findMaxLineFunction · 0.70
visibleLinesFunction · 0.70
updateDisplayIfNeededFunction · 0.70
applyTextInputFunction · 0.70
codemirror.jsFile · 0.70
posToDOMFunction · 0.70
clipPosFunction · 0.70
skipAtomicFunction · 0.70
drawForLineFunction · 0.70
drawSelectionRangeFunction · 0.70
findStartLineFunction · 0.70
getStateBeforeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…