(lines: InputLineRanges, cursor: number)
| 423 | } |
| 424 | |
| 425 | function findLineIndexAtCursor(lines: InputLineRanges, cursor: number): number { |
| 426 | const c = Math.max(0, cursor); |
| 427 | for (let i = 0; i < lines.ends.length; i++) { |
| 428 | const end = lines.ends[i] ?? 0; |
| 429 | if (c <= end) return i; |
| 430 | } |
| 431 | return Math.max(0, lines.ends.length - 1); |
| 432 | } |
| 433 | |
| 434 | function moveCursorToLineEdge(value: string, cursor: number, edge: "home" | "end"): number { |
| 435 | const lines = buildInputLineRanges(value); |
no outgoing calls
no test coverage detected