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

Function lineNo

external/.scrollLibs.js:1027–1042  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

1025 // Given a line object, find its line number by walking up through
1026 // its parent links.
1027 function lineNo(line) {
1028 if (line.parent == null) {
1029 return null
1030 }
1031 var cur = line.parent,
1032 no = indexOf(cur.lines, line)
1033 for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
1034 for (var i = 0; ; ++i) {
1035 if (chunk.children[i] == cur) {
1036 break
1037 }
1038 no += chunk.children[i].chunkSize()
1039 }
1040 }
1041 return no + cur.first
1042 }
1043
1044 // Find the line at the given vertical position, using the height
1045 // information in the document tree.

Callers 15

visualLineNoFunction · 0.85
visualLineEndNoFunction · 0.85
getLineStylesFunction · 0.85
.scrollLibs.jsFile · 0.85
buildLineContentFunction · 0.85
LineViewFunction · 0.85
mapFromLineViewFunction · 0.85
prepareMeasureForLineFunction · 0.85
changeLineFunction · 0.85
addLineWidgetFunction · 0.85

Calls 1

indexOfFunction · 0.85

Tested by

no test coverage detected