fix(tui): keep a long error inside the status row - #970
Merged
Conversation
An error wider than the chat column widened the whole column, because JoinHorizontal pads every row of a block to its widest row. One 273-column status row in a 120-column terminal made the left column 273 wide and pushed the sidebar past the right edge, so the agent tree disappeared and the terminal wrapped the frame. A wrapped exception carries newlines too, which turned the one-line row into four and grew the frame past the bottom. Textual clipped this for free: #agent_status_display is height 1 and #status_text is width 1fr, so the widget bounded its own content. Nothing bounds it here unless it is truncated. Messages are now flattened to a single line and clipped, with the message yielding before its hint so "Send message to resume" stays readable behind a long one. statusView clamps whatever it ends up with, so no later branch can widen the frame. setupMsg flattens as well - the start screen budgets log rows per entry, so a four-line error rendered as four rows and pushed the launch column off the bottom. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Greptile SummaryThe PR confines long, multiline TUI errors to their allocated status or setup-log row and completes the narrow-terminal fix from the previous review.
Confidence Score: 5/5The PR appears safe to merge. The previously reported quit-hint overflow is fixed: the status composer now drops the hint when it cannot fit, truncates remaining content using display width, and pads every positive-width row to exactly the requested width; no blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "hold the status row to its width in a na..." | Re-trigger Greptile |
The clamp reserved room for the quit hint but then added a leading column, a minimum column of status text and a separator on top of it, so any width of 13 or less produced a 14-column row - the same overflow, just at a size the first fix did not reach. The row is now composed once, to exactly the width it is given. When the terminal cannot fit the hint beside any status text the hint goes, because the status is the part carrying information and ctrl-q works whether or not the row has room to say so. Reported by Greptile on #970. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A red error string filled the screen and pushed the agent tree out of the frame.
Cause
statusViewbuilt its row with no width clamp and no newline handling, and two things compounded:lipgloss.JoinHorizontalpads every row of a block to its widest row, so a single 273-column status row in a 120-column terminal made the left column 273 wide and pushed the sidebar past the right edge. The agent tree was not overwritten, it was shoved off screen, and the terminal wrapped the frame.Measured on a 120x24 terminal with a
litellm.APIConnectionErrorplus traceback:Textual clipped this for free:
#agent_status_displayisheight: 1and#status_textiswidth: 1fr, so the widget bounded its own content. Nothing bounds it in lipgloss unless it is truncated.Changes
flattenStatuscollapses newlines, tabs and whitespace runs to one line.statusMessageflattens, then truncates the message to leave room for its hint, so· Send message to resumestays readable behind a 500-character error instead of being clipped away.statusViewclamps whateverleftends up as, so no later branch can widen the frame.setupMsgflattens too. The start screen budgets log rows per entry, so a four-line error rendered as four rows and pushed the launch column off the bottom. It already truncated width but not newlines.Tests
Three added:
All three Go packages pass. Verified visually by rendering the frame: sidebar intact, error on one line ending in
…,ctrl-q quitstill on the right.🤖 Generated with Claude Code