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