(text: string, cursor: number)
| 52 | } |
| 53 | |
| 54 | function findLineEnd(text: string, cursor: number): number { |
| 55 | let pos = Math.max(0, Math.min(cursor, text.length)) |
| 56 | while (pos < text.length && text[pos] !== '\n') { |
| 57 | pos++ |
| 58 | } |
| 59 | return pos |
| 60 | } |
| 61 | |
| 62 | function findPreviousWordBoundary(text: string, cursor: number): number { |
| 63 | let pos = Math.max(0, Math.min(cursor, text.length)) |