MCPcopy Create free account
hub / github.com/sql-js/sql.js / getLine

Function getLine

GUI/codemirror/lib/codemirror.js:6478–6489  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

6476
6477 // Find the line object corresponding to the given line number.
6478 function getLine(doc, n) {
6479 n -= doc.first;
6480 if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document.");
6481 for (var chunk = doc; !chunk.lines;) {
6482 for (var i = 0;; ++i) {
6483 var child = chunk.children[i], sz = child.chunkSize();
6484 if (n < sz) { chunk = child; break; }
6485 n -= sz;
6486 }
6487 }
6488 return chunk.lines[n];
6489 }
6490
6491 // Get the part of a document between two positions, as an array of
6492 // strings.

Callers 15

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

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…