fix(tui): remove spurious blank line from every assistant message#2369
Merged
dgageot merged 1 commit intodocker:mainfrom Apr 10, 2026
Merged
Conversation
Commit 574a466 introduced the copy-on-hover button for assistant messages using the same "topRow+\n" pattern as user messages. However, UserMessageStyle has PaddingTop=1 (inherited from BaseMessageStyle) so PaddingTop(0)+topRow+"\n" is net-zero. AssistantMessageStyle overrides to Padding(0,1), meaning PaddingTop=0 already; PaddingTop(0) is a no-op and the unconditional "\n" prefix adds a spurious blank line to every assistant message in its normal (non-hovered) state. Fix: only use the topRow+"\n" rendering path when the copy icon is actually visible (hovered or selected). Fall back to the original messageStyle.Render(rendered) for the common case. This accepts a 1-line layout shift on hover rather than a permanent blank-line artifact on every message. Fixes: docker#2368 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dgageot
approved these changes
Apr 10, 2026
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.
Problem
Since v1.41.0 (commit 574a466), every assistant message in the TUI has an extra blank line at the top in its normal (non-hovered) state. In longer conversations this accumulates, causing the input area to be displaced and ghost text to appear at unexpected positions on screen. The artifacts are most visible when the session panel is open.
Closes #2368
Root cause
The copy-button commit applied the user-message "topRow+
\n" rendering pattern to assistant messages without accounting for a style difference:PaddingTop(0)effecttopRow+"\n"net changeUserMessageStyleBaseMessageStyle.Padding(1,1))AssistantMessageStyleBaseMessageStyle.Padding(0,1)override)The unconditional
topRow+"\n"+renderedalways prepends"\n"when not hovered/selected (becausetopRow == ""), adding one blank line to every assistant message at all times.Fix
Only use the
topRow+"\n"path when the copy icon is actually visible (hovered or selected). For the common case fall back to the originalmessageStyle.Render(rendered)from before 574a466.The trade-off is a 1-line layout shift when transitioning into the hovered/selected state. A layout-shift-free fix would require giving
AssistantMessageStyleaPaddingTop(1)(matchingUserMessageStyle) and fillingtopRowwith spaces when not hovered — but that changes the visual appearance of all assistant messages. The simpler fix here is least-invasive and fully restores v1.40.0 rendering behaviour for the common path.Testing
Verified:
go build ./pkg/tui/...clean on currentmain.