MCPcopy Create free account
hub / github.com/TruthHun/BookStack / lineNo

Function lineNo

static/editor.md/lib/codemirror/lib/codemirror.js:7572–7582  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

7570 // Given a line object, find its line number by walking up through
7571 // its parent links.
7572 function lineNo(line) {
7573 if (line.parent == null) return null;
7574 var cur = line.parent, no = indexOf(cur.lines, line);
7575 for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
7576 for (var i = 0;; ++i) {
7577 if (chunk.children[i] == cur) break;
7578 no += chunk.children[i].chunkSize();
7579 }
7580 }
7581 return no + cur.first;
7582 }
7583
7584 // Find the line at the given vertical position, using the height
7585 // information in the document tree.

Callers 15

codemirror.jsFile · 0.70
locateNodeInLineViewFunction · 0.70
findFunction · 0.70
mapFromLineViewFunction · 0.70
prepareMeasureForLineFunction · 0.70
coordsCharFunction · 0.70
LineViewFunction · 0.70
changeLineFunction · 0.70
visualLineNoFunction · 0.70
visualLineEndNoFunction · 0.70

Calls 1

indexOfFunction · 0.70

Tested by

no test coverage detected