MCPcopy
hub / github.com/jagenjo/webglstudio.js / getLine

Function getLine

editor/js/extra/codemirror/codemirror.js:7766–7777  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

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