Skip to content

TUI: Terminal resize accumulates blank separator lines #22976

@iaendi

Description

@iaendi

Impact

When working with multiple Hermes TUI sessions side by side — a common workflow for managing parallel development tasks — users resize terminal windows frequently. Each resize event causes blank separator lines () to accumulate in the prompt area. After a few resize operations, the TUI becomes cluttered with dozens of ghost lines, forcing the user to run /clear repeatedly.

This is not a cosmetic issue. It interrupts the development flow for users who rely on multi-window Hermes setups to manage concurrent agent tasks.

Steps to Reproduce

  1. Run hermes --tui in multiple terminal windows
  2. Start a conversation in each
  3. Resize any of the terminal windows (drag edge, maximize/restore, or switch between full-screen splits)
  4. Observe: each resize adds one or more blank lines filled with below the input prompt
Image Image

Root Cause

The status bar separator in ui-tui/src/components/appChrome.tsx (lines ~294-297 and ~335) renders hardcoded characters. On terminal resize:

  1. Node.js stdout.on('resize') fires (ui-tui/src/app/useMainApp.ts:413)
  2. Ink's AlternateScreen re-renders the full React tree
  3. The separator lines are re-drawn at the new terminal size
  4. However, Ink's virtual DOM diff does not clear the previous terminal output — old separator characters remain visible while new ones are rendered on top
  5. Result: each resize appends one more layer of ghost separators

This is an Ink rendering engine edge case: React's VDOM diff has no awareness of physical terminal geometry changes, so it cannot reconcile "the canvas just got wider/taller" against "the existing screen content needs invalidation."

Environment

  • Hermes Agent version: (Hermes Agent v0.12.0 (2026.4.30))
  • OS: macOS
  • Terminal: (Terminal.app)
  • TUI mode: hermes --tui

Request

This is not a feature request for a workaround. The /clear command exists but is a palliative measure — it does not prevent the issue from recurring on the next resize.

The fix should address the root cause: Ink's AlternateScreen must perform a full buffer clear before re-rendering on resize events, or the TUI must explicitly manage resize lifecycle to prevent separator-line accumulation.

Affected code paths:

  • ui-tui/src/components/appChrome.tsx:294-297 — leading separator in StatusRule
  • ui-tui/src/components/appChrome.tsx:335 — cwd separator
  • ui-tui/src/app/useMainApp.ts:405-411 — resize event handler (currently just forwards new column count, does not trigger screen invalidation)

A proper fix would ensure that after any resize event, the TUI renders on a clean slate rather than diffing against stale terminal output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/tuiTerminal UI (ui-tui/ + tui_gateway/)javascriptPull requests that update javascript codetype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions