Feature: API or signal to trigger full re-render after terminal resize
Problem
When a terminal is resized to a narrower width and then expanded back, Ink's output from the narrow period stays "squished" — short lines in a wide terminal. This happens because:
- Terminal shrinks (e.g., 120 → 60 cols) → SIGWINCH sent
- Ink redraws current frame at 60 cols ✓
- Terminal expands back to 120 cols → SIGWINCH sent
- Ink redraws current frame at 120 cols ✓
- But scrollback content rendered during the narrow period stays at 60 chars
This is a fundamental issue for any terminal embedding scenario (split panes, side panels, etc.) where the terminal width changes temporarily.
Proposal
Add a mechanism for the hosting terminal/application to request a full re-render — not just the current frame, but a complete clear-and-redraw that would fix the visual appearance of previously rendered output.
Possible approaches:
- Signal handler (e.g.,
SIGUSR1) — terminal sends signal, Ink clears screen and redraws everything - Public API —
instance.fullRedraw()orinstance.clearAndRerender()that clears all previously rendered output and redraws from scratch - Escape sequence response — Ink listens for a custom escape sequence (e.g., via stdin) and triggers a full repaint
Use case
Terminal multiplexers and terminal embedding apps (like Tauri-based terminals with side panels) frequently resize terminals temporarily. The squished output is a common complaint. Having a way to trigger a full repaint after resize would solve this across all embedding scenarios.
Current workaround
None that I'm aware of. The only option is to restart the Ink application.
Source: vadimdemedes/ink