MCPcopy
hub / github.com/csev/py4e / lineNo

Function lineNo

tools/pythonauto/static/codemirrorepl/codemirror.js:6470–6480  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

6468 // Given a line object, find its line number by walking up through
6469 // its parent links.
6470 function lineNo(line) {
6471 if (line.parent == null) return null;
6472 var cur = line.parent, no = indexOf(cur.lines, line);
6473 for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
6474 for (var i = 0;; ++i) {
6475 if (chunk.children[i] == cur) break;
6476 no += chunk.children[i].chunkSize();
6477 }
6478 }
6479 return no + cur.first;
6480 }
6481
6482 // Find the line at the given vertical position, using the height
6483 // information in the document tree.

Callers 13

mapFromLineViewFunction · 0.70
prepareMeasureForLineFunction · 0.70
coordsCharFunction · 0.70
LineViewFunction · 0.70
changeLineFunction · 0.70
codemirror.jsFile · 0.70
visualLineNoFunction · 0.70
visualLineEndNoFunction · 0.70
getLineStylesFunction · 0.70
lineStartFunction · 0.70

Calls 1

indexOfFunction · 0.70

Tested by

no test coverage detected