(from: number, to: number)
| 83 | }; |
| 84 | // Mark [from, to) of the text, which may span lines, as raw string contents. |
| 85 | const mark = (from: number, to: number): void => { |
| 86 | seek(from); |
| 87 | let l = line; |
| 88 | let start = from - lineStart - (hasCarriageReturns ? carriageReturnsIn(text, lineStart, from) : 0); |
| 89 | for (let k = from; ;) { |
| 90 | const nl = text.indexOf('\n', k); |
| 91 | const end = nl < 0 || nl >= to ? to : nl; |
| 92 | const width = end - k - (hasCarriageReturns ? carriageReturnsIn(text, k, end) : 0); |
| 93 | if (width > 0) (lines.get(l) ?? lines.set(l, []).get(l)!).push([start, start + width]); |
| 94 | if (end === to) break; |
| 95 | k = end + 1; |
| 96 | l++; |
| 97 | start = 0; |
| 98 | } |
| 99 | }; |
| 100 | let i = 0; |
| 101 | while (i < n) { |
| 102 | const c = text.charCodeAt(i); |
no test coverage detected