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