MCPcopy Create free account
hub / github.com/TruthHun/BookStack / getLine

Function getLine

static/mergely/lib/codemirror.js:7761–7772  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

7759
7760 // Find the line object corresponding to the given line number.
7761 function getLine(doc, n) {
7762 n -= doc.first;
7763 if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document.");
7764 for (var chunk = doc; !chunk.lines;) {
7765 for (var i = 0;; ++i) {
7766 var child = chunk.children[i], sz = child.chunkSize();
7767 if (n < sz) { chunk = child; break; }
7768 n -= sz;
7769 }
7770 }
7771 return chunk.lines[n];
7772 }
7773
7774 // Get the part of a document between two positions, as an array of
7775 // strings.

Callers 15

findMaxLineFunction · 0.70
visibleLinesFunction · 0.70
updateDisplayIfNeededFunction · 0.70
applyTextInputFunction · 0.70
triggerElectricFunction · 0.70
codemirror.jsFile · 0.70
posToDOMFunction · 0.70
clipPosFunction · 0.70
skipAtomicInnerFunction · 0.70
movePosFunction · 0.70
drawForLineFunction · 0.70
drawSelectionRangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected