(doc, n)
| 889 | |
| 890 | // Find the line object corresponding to the given line number. |
| 891 | function getLine(doc, n) { |
| 892 | n -= doc.first; |
| 893 | if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") } |
| 894 | var chunk = doc; |
| 895 | while (!chunk.lines) { |
| 896 | for (var i = 0;; ++i) { |
| 897 | var child = chunk.children[i], sz = child.chunkSize(); |
| 898 | if (n < sz) { chunk = child; break } |
| 899 | n -= sz; |
| 900 | } |
| 901 | } |
| 902 | return chunk.lines[n] |
| 903 | } |
| 904 | |
| 905 | // Get the part of a document between two positions, as an array of |
| 906 | // strings. |
no outgoing calls
no test coverage detected