(doc, n)
| 965 | |
| 966 | // Find the line object corresponding to the given line number. |
| 967 | function getLine(doc, n) { |
| 968 | n -= doc.first |
| 969 | if (n < 0 || n >= doc.size) { |
| 970 | throw new Error("There is no line " + (n + doc.first) + " in the document.") |
| 971 | } |
| 972 | var chunk = doc |
| 973 | while (!chunk.lines) { |
| 974 | for (var i = 0; ; ++i) { |
| 975 | var child = chunk.children[i], |
| 976 | sz = child.chunkSize() |
| 977 | if (n < sz) { |
| 978 | chunk = child |
| 979 | break |
| 980 | } |
| 981 | n -= sz |
| 982 | } |
| 983 | } |
| 984 | return chunk.lines[n] |
| 985 | } |
| 986 | |
| 987 | // Get the part of a document between two positions, as an array of |
| 988 | // strings. |
no outgoing calls
no test coverage detected