MCPcopy
hub / github.com/tilemill-project/tilemill / getLine

Function getLine

assets/js/codemirror.js:7763–7774  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

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

Callers 15

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

Calls

no outgoing calls

Tested by

no test coverage detected