fix(cli): preserve startup scrollback on resize#23294
Conversation
|
This PR addresses one specific symptom of a broader issue: the CLI/TUI does not reflow content on terminal resize. There are 34+ open bugs about various manifestations of this problem. I've opened a tracking feature request (#24164) that proposes a comprehensive solution — a SIGWINCH handler triggering full re-render at new viewport dimensions, comparable to how opencode and Claude Code handle resize smoothly. If this PR gets merged, please consider whether the underlying architecture supports full reflow, or if we still need a systematic fix. The tracking issue consolidates all related work: |
|
Closing as superseded — the same fix landed via #25227 / commit e2b2d48 "fix(cli): preserve startup banner on terminal resize" before this PR could be reviewed. Current |
What does this PR do?
Preserve the classic CLI startup banner and tool summary during terminal resize recovery by resetting prompt_toolkit's renderer instead of wiping the physical terminal scrollback.
Related Issue
Fixes #22999
Type of Change
Changes Made
/Users/leongong/Desktop/LeonProjects/worktrees/hermes-agent/hermes-22999-cli-resize-banner/cli.pyso resize recovery calls the original prompt_toolkit resize path first, then resets the renderer and invalidates for a clean repaint/Users/leongong/Desktop/LeonProjects/worktrees/hermes-agent/hermes-22999-cli-resize-banner/tests/cli/test_cli_force_redraw.pyto assert the resize path preserves scrollback and still repaints the prompt chromeHow to Test
uv run --frozen pytest -q -o addopts='' tests/cli/test_cli_force_redraw.pyChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
uv run --frozen pytest -q -o addopts='' tests/cli/test_cli_force_redraw.py→9 passeduv run --frozen ruff check cli.py tests/cli/test_cli_force_redraw.py→ passed