(line)
| 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. |
no test coverage detected