(line)
| 7833 | // Given a line object, find its line number by walking up through |
| 7834 | // its parent links. |
| 7835 | function lineNo(line) { |
| 7836 | if (line.parent == null) return null; |
| 7837 | var cur = line.parent, no = indexOf(cur.lines, line); |
| 7838 | for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { |
| 7839 | for (var i = 0;; ++i) { |
| 7840 | if (chunk.children[i] == cur) break; |
| 7841 | no += chunk.children[i].chunkSize(); |
| 7842 | } |
| 7843 | } |
| 7844 | return no + cur.first; |
| 7845 | } |
| 7846 | |
| 7847 | // Find the line at the given vertical position, using the height |
| 7848 | // information in the document tree. |
no test coverage detected