(doc, n)
| 7791 | |
| 7792 | // Find the line object corresponding to the given line number. |
| 7793 | function getLine(doc, n) { |
| 7794 | n -= doc.first; |
| 7795 | if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); |
| 7796 | for (var chunk = doc; !chunk.lines;) { |
| 7797 | for (var i = 0;; ++i) { |
| 7798 | var child = chunk.children[i], sz = child.chunkSize(); |
| 7799 | if (n < sz) { chunk = child; break; } |
| 7800 | n -= sz; |
| 7801 | } |
| 7802 | } |
| 7803 | return chunk.lines[n]; |
| 7804 | } |
| 7805 | |
| 7806 | // Get the part of a document between two positions, as an array of |
| 7807 | // strings. |
no outgoing calls
no test coverage detected