MCPcopy
hub / github.com/agentejo/cockpit / getLine

Function getLine

assets/lib/codemirror/lib/codemirror.js:892–904  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

890
891 // Find the line object corresponding to the given line number.
892 function getLine(doc, n) {
893 n -= doc.first;
894 if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
895 var chunk = doc;
896 while (!chunk.lines) {
897 for (var i = 0;; ++i) {
898 var child = chunk.children[i], sz = child.chunkSize();
899 if (n < sz) { chunk = child; break }
900 n -= sz;
901 }
902 }
903 return chunk.lines[n]
904 }
905
906 // Get the part of a document between two positions, as an array of
907 // strings.

Callers 15

clipPosFunction · 0.85
getContextBeforeFunction · 0.85
takeTokenFunction · 0.85
findStartLineFunction · 0.85
retreatFrontierFunction · 0.85
stretchSpansOverChangeFunction · 0.85
visualLineNoFunction · 0.85
visualLineEndNoFunction · 0.85
findMaxLineFunction · 0.85
buildViewArrayFunction · 0.85
charCoordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected