| 47 | * move the cursor up by the right amount — counting logical lines undercounts when |
| 48 | * long options (e.g. long base URLs) wrap, leaving stale rows that pile up. */ |
| 49 | export function physicalRows(s: string, cols: number): number { |
| 50 | if (cols <= 0) return 1; |
| 51 | return Math.max(1, Math.ceil(displayWidth(s) / cols)); |
| 52 | } |
| 53 | |
| 54 | /** Compute the next highlighted index for a keypress. Returns the same index for no-op keys. Pure → testable. */ |
| 55 | export function moveSelection(current: number, keyName: string | undefined, len: number): number { |