(lineNumber: number)
| 1020 | } |
| 1021 | |
| 1022 | goToLine(lineNumber: number): Cursor { |
| 1023 | // Go to the beginning of the specified logical line (1-indexed, like vim) |
| 1024 | // Uses logical lines (separated by \n), not wrapped display lines |
| 1025 | const lines = this.text.split('\n') |
| 1026 | const targetLine = Math.min(Math.max(0, lineNumber - 1), lines.length - 1) |
| 1027 | let offset = 0 |
| 1028 | for (let i = 0; i < targetLine; i++) { |
| 1029 | offset += (lines[i]?.length ?? 0) + 1 // +1 for newline |
| 1030 | } |
| 1031 | return new Cursor(this.measuredText, offset, 0) |
| 1032 | } |
| 1033 | |
| 1034 | endOfFile(): Cursor { |
| 1035 | return new Cursor(this.measuredText, this.text.length, 0) |
no test coverage detected