(doc, n)
| 7759 | |
| 7760 | // Find the line object corresponding to the given line number. |
| 7761 | function getLine(doc, n) { |
| 7762 | n -= doc.first; |
| 7763 | if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); |
| 7764 | for (var chunk = doc; !chunk.lines;) { |
| 7765 | for (var i = 0;; ++i) { |
| 7766 | var child = chunk.children[i], sz = child.chunkSize(); |
| 7767 | if (n < sz) { chunk = child; break; } |
| 7768 | n -= sz; |
| 7769 | } |
| 7770 | } |
| 7771 | return chunk.lines[n]; |
| 7772 | } |
| 7773 | |
| 7774 | // Get the part of a document between two positions, as an array of |
| 7775 | // strings. |
no outgoing calls
no test coverage detected