(lineNumber: number)
| 995 | } |
| 996 | |
| 997 | goToLine(lineNumber: number): Cursor { |
| 998 | // Go to the beginning of the specified logical line (1-indexed, like vim) |
| 999 | // Uses logical lines (separated by \n), not wrapped display lines |
| 1000 | const lines = this.text.split('\n') |
| 1001 | const targetLine = Math.min(Math.max(0, lineNumber - 1), lines.length - 1) |
| 1002 | let offset = 0 |
| 1003 | for (let i = 0; i < targetLine; i++) { |
| 1004 | offset += (lines[i]?.length ?? 0) + 1 // +1 for newline |
| 1005 | } |
| 1006 | return new Cursor(this.measuredText, offset, 0) |
| 1007 | } |
| 1008 | |
| 1009 | endOfFile(): Cursor { |
| 1010 | return new Cursor(this.measuredText, this.text.length, 0) |
no test coverage detected