Skip to content

fix(tui): display fixes across chat and secondary screens - #4494

Merged
kovtcharov-amd merged 10 commits into
amd:mainfrom
kovtcharov:kalin/tui-display-fixes
Sep 29, 2026
Merged

kovtcharov-amd merged 10 commits into
amd:mainfrom
kovtcharov:kalin/tui-display-fixes

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

This follows up #4457. Driving the TUI in a real terminal turned up display bugs across the chat screen and the secondary screens; most were already in main. The worst: typing while the agent worked wrapped the whole screen at every width. Each fix below has a regression test that fails without it.

Chat screen

  • Answers stop wrapping early at hyphens. Any paragraph with a flag, a hyphenated word or -m ended rows well short of the window and stranded words (python - / m / pytest). The cause is a line-length miscount in muesli/reflow, the wrapper glamour uses; it has no maintained release, so it's vendored under tui/third_party with the one-line fix (the README there says when to drop it).
  • Typing mid-turn no longer wraps every row. The Enter hint was appended after a composer that already spanned the pane, so every row of the frame overran the terminal.
  • A failed command now shows as failed. python -m pytest exiting 2 drew as a passed step, because the shell tool reports success whenever the command runs.
  • A long or multi-line question hangs under its text instead of wrapping to column 0, where it read as stray output.
  • Answers lost their extra blank rows. Glamour pads every document top and bottom, which doubled each gap and dropped the finished answer a row below its streamed copy.
  • Inline code lost its padding. It had doubled the spaces around every path and flag (run pytest now).

Other screens

  • Agents panel: the highlighted agent could be off screen in a long list, and Enter switched to a row you couldn't see.
  • Gateway screen: it ignored the window size; with 76 models the title and cursor scrolled off, and narrow windows overflowed.
  • Question panel: a long URL or path shifted the click targets, so a click could pick the wrong option.
  • Provider panel: the key hint was cut mid-word at 69–73 columns.
  • Overlays: resizing while the gateway, provider panel or an agent-switch gate was up left the screen underneath laid out for the old size.

Test plan

  • cd tui && go test ./...
  • Ask for a paragraph full of commands and flags (e.g. "explain python -m pytest -q -x"): rows fill to the width, and no word is stranded alone on a row.
  • During a turn, type in the composer at 60, 80 and 120 columns: nothing wraps, and the ⏎ hint shows beside the text.
  • Ask for something that runs a failing command (e.g. pytest on a broken test): its step reads failed — exit N in red.
  • /agents with more agents than fit, and /gateway in a short window: the highlighted row stays visible.

…code

- A shell command that exited non-zero drew as a passed step ("└ exit 2"
  in the success colour): the shell tool reports success when the command
  ran. The exit code now decides.
- A long or multi-line question wrapped flush to column 0, so its second
  line read as stray output; continuations now hang under the text.
- Inline code kept the builtin style's one-space padding after its box
  was removed, doubling the spaces around every path and flag.
- gofmt drift in control/state.go and client/wire_contract_test.go.
Glamour pads each rendered document with a blank row above and below. On top
of the transcript's own spacing every gap around an answer became two rows,
and the finished answer sat a row lower than its streamed copy.
The mid-turn Enter hint was appended after a composer that already spanned
the pane, so that row overran the terminal and JoinVertical padded every row
of the frame to match: at any width, the screen wrapped the moment the user
typed while the agent worked. The composer now gives the hint its width.
At 69-73 columns the provider panel's model-list hint was cut mid-word ("esc b…"): the compact hint only kicked in below 65 columns, but the full one is 71 wide.
A list taller than the window was cropped to its tail, so the highlighted agent near the top was invisible and Enter switched to a row the user could not see. The rows now scroll around the selection.
The gateway screen ignored the window size. With the 76 models the gateway advertises, the list ran off the bottom, the terminal kept only its tail, and the cursor row, title and top models were not on screen. Narrow terminals also overflowed on the intro text, the 60-cell input and the one-row key list. The screen now wraps to the width, scrolls the model list around the cursor, and breaks the key list between keys.
A URL or path wider than the question panel was wrapped by lipgloss at render time rather than by the panel's own layout, so the panel grew rows the click map never counted and a click could land on a different option or on nothing. Words wider than the panel are now broken in layout.
A resize while the gateway screen, the AI-provider panel or an agent-switch gate was up reached only that screen. Leaving it redrew the chat or readiness gate at the old size, so every line overflowed a window that had shrunk. The current size is now handed back on the way out.
@github-actions github-actions Bot added the tui Go terminal UI (gaia-tui) label Sep 29, 2026
Answers sometimes stopped well short of the window and stranded words on
short rows ("python -" / "m" / "pytest"). Glamour wraps paragraphs with
muesli/reflow's wordwrap, which writes a "-" breakpoint without counting it
toward the line length, so each hyphen made a line one column longer than
its limit; glamour then re-wrapped the overflow. Any paragraph with a flag,
a hyphenated word or a `-m` hit it.

reflow v0.3.0 is the latest release and unmaintained, so the module is
vendored under tui/third_party with the one-line fix and wired in with a
replace directive (tui/third_party/README.md records why and when to drop it).
Upstream project files, not source: they never run from a subdirectory and
only add noise to the vendored module.
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 29, 2026
Merged via the queue into amd:main with commit f76ff0d Sep 29, 2026
41 of 43 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/tui-display-fixes branch September 29, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants