From 955a9b703b73e3076d52ddd3285bee653d61b56e Mon Sep 17 00:00:00 2001 From: patriceckhart Date: Mon, 27 Apr 2026 15:59:35 +0200 Subject: [PATCH] tui: collapse double-blank between adjacent tool boxes Each tool result owns its own box, but the assistant message that batched the originating tool_use blocks now renders to nothing (the box edges moved to the tool result). Build() was still emitting an inter-message blank for that empty render, which compounded with the blank from the next real message and produced two blank rows between adjacent tool boxes \u2014 visible whenever the model batched multiple tool calls without prose between them. Skip the inter-message blank when a message rendered to zero lines so an empty assistant message no longer contributes a separator row. Adjacent tool boxes now sit one blank row apart, matching the spacing between every other pair of chat blocks. --- internal/tui/view.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/tui/view.go b/internal/tui/view.go index 39f9543..86d8985 100644 --- a/internal/tui/view.go +++ b/internal/tui/view.go @@ -232,6 +232,15 @@ func (v *View) BuildWithAnchors(width int) ([]string, []MessageAnchor) { for idx := range v.Messages { anchors = append(anchors, MessageAnchor{MessageIdx: idx, Row: len(out)}) out = append(out, rendered[idx]...) + // Skip the inter-message blank for messages that rendered + // to nothing. An assistant message whose only content is + // ToolCallBlock(s) has no rendered output of its own (each + // tool result owns its box now), so emitting a blank for it + // would compound with the blank from the next real message + // and produce two blank rows between adjacent tool boxes. + if len(rendered[idx]) == 0 { + continue + } out = append(out, "") } // Only render the streaming header/body when there's actual