(doc, n)
| 6476 | |
| 6477 | // Find the line object corresponding to the given line number. |
| 6478 | function getLine(doc, n) { |
| 6479 | n -= doc.first; |
| 6480 | if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); |
| 6481 | for (var chunk = doc; !chunk.lines;) { |
| 6482 | for (var i = 0;; ++i) { |
| 6483 | var child = chunk.children[i], sz = child.chunkSize(); |
| 6484 | if (n < sz) { chunk = child; break; } |
| 6485 | n -= sz; |
| 6486 | } |
| 6487 | } |
| 6488 | return chunk.lines[n]; |
| 6489 | } |
| 6490 | |
| 6491 | // Get the part of a document between two positions, as an array of |
| 6492 | // strings. |
no outgoing calls
no test coverage detected
searching dependent graphs…