(text: string, cursor: number)
| 44 | |
| 45 | // Helper functions for text manipulation |
| 46 | function findLineStart(text: string, cursor: number): number { |
| 47 | let pos = Math.max(0, Math.min(cursor, text.length)) |
| 48 | while (pos > 0 && text[pos - 1] !== '\n') { |
| 49 | pos-- |
| 50 | } |
| 51 | return pos |
| 52 | } |
| 53 | |
| 54 | function findLineEnd(text: string, cursor: number): number { |
| 55 | let pos = Math.max(0, Math.min(cursor, text.length)) |