MCPcopy Create free account
hub / github.com/breck7/scroll / getLine

Function getLine

external/.scrollLibs.js:967–985  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

965
966 // Find the line object corresponding to the given line number.
967 function getLine(doc, n) {
968 n -= doc.first
969 if (n < 0 || n >= doc.size) {
970 throw new Error("There is no line " + (n + doc.first) + " in the document.")
971 }
972 var chunk = doc
973 while (!chunk.lines) {
974 for (var i = 0; ; ++i) {
975 var child = chunk.children[i],
976 sz = child.chunkSize()
977 if (n < sz) {
978 chunk = child
979 break
980 }
981 n -= sz
982 }
983 }
984 return chunk.lines[n]
985 }
986
987 // Get the part of a document between two positions, as an array of
988 // strings.

Callers 15

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

Calls

no outgoing calls

Tested by

no test coverage detected