(doc, n)
| 7528 | |
| 7529 | // Find the line object corresponding to the given line number. |
| 7530 | function getLine(doc, n) { |
| 7531 | n -= doc.first; |
| 7532 | if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); |
| 7533 | for (var chunk = doc; !chunk.lines;) { |
| 7534 | for (var i = 0;; ++i) { |
| 7535 | var child = chunk.children[i], sz = child.chunkSize(); |
| 7536 | if (n < sz) { chunk = child; break; } |
| 7537 | n -= sz; |
| 7538 | } |
| 7539 | } |
| 7540 | return chunk.lines[n]; |
| 7541 | } |
| 7542 | |
| 7543 | // Get the part of a document between two positions, as an array of |
| 7544 | // strings. |
no outgoing calls
no test coverage detected
searching dependent graphs…