(doc, n)
| 6426 | |
| 6427 | // Find the line object corresponding to the given line number. |
| 6428 | function getLine(doc, n) { |
| 6429 | n -= doc.first; |
| 6430 | if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); |
| 6431 | for (var chunk = doc; !chunk.lines;) { |
| 6432 | for (var i = 0;; ++i) { |
| 6433 | var child = chunk.children[i], sz = child.chunkSize(); |
| 6434 | if (n < sz) { chunk = child; break; } |
| 6435 | n -= sz; |
| 6436 | } |
| 6437 | } |
| 6438 | return chunk.lines[n]; |
| 6439 | } |
| 6440 | |
| 6441 | // Get the part of a document between two positions, as an array of |
| 6442 | // strings. |
no outgoing calls
no test coverage detected