(line)
| 932 | // Given a line object, find its line number by walking up through |
| 933 | // its parent links. |
| 934 | function lineNo(line) { |
| 935 | if (line.parent == null) { return null } |
| 936 | var cur = line.parent, no = indexOf(cur.lines, line); |
| 937 | for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { |
| 938 | for (var i = 0;; ++i) { |
| 939 | if (chunk.children[i] == cur) { break } |
| 940 | no += chunk.children[i].chunkSize(); |
| 941 | } |
| 942 | } |
| 943 | return no + cur.first |
| 944 | } |
| 945 | |
| 946 | // Find the line at the given vertical position, using the height |
| 947 | // information in the document tree. |
no test coverage detected