tui: add blank interior rows at top and bottom of tool boxes

Body content used to start on the row immediately under the top
edge and end on the row immediately above the bottom edge, leaving
the box visually cramped against its corners.

Insert a blank box-side row (a \u2502 \u2026 \u2502 with no content) after the
top edge and before the bottom edge in both the transcript path
(renderMessage RoleTool branch) and the live overlay path
(renderToolCall, both streaming and finished-with-body). Empty-
bodied boxes (finished call with no result) stay compact \u2014 the top
and bottom edges sit directly adjacent so a no-output tool doesn't
render as a tall hollow frame.
This commit is contained in:
patriceckhart 2026-04-27 16:08:48 +02:00
parent 955a9b703b
commit 48d22c4815

View file

@ -561,6 +561,7 @@ func (v *View) renderMessage(m provider.Message, width int, turnOpen bool) []str
// in one assistant message render as N adjacent boxes
// instead of stacking unclosed top edges.
lines = append(lines, toolBoxTop(v.Theme, label, width))
lines = append(lines, toolBoxSide(v.Theme, "", width))
if tr.IsError {
lines = append(lines, toolBoxSide(v.Theme, v.Theme.FG256(color, " error"), width))
}
@ -576,6 +577,7 @@ func (v *View) renderMessage(m provider.Message, width int, turnOpen bool) []str
}
lines = append(lines, toolBoxSide(v.Theme, body, width))
}
lines = append(lines, toolBoxSide(v.Theme, "", width))
lines = append(lines, toolBoxBottom(v.Theme, width))
}
}
@ -608,9 +610,11 @@ func (v *View) renderToolCall(tc ToolCallView, width int) []string {
if tc.Streaming && tc.Result == "" {
lines = append(lines, "")
lines = append(lines, toolBoxTop(v.Theme, label, width))
lines = append(lines, toolBoxSide(v.Theme, "", width))
if body := v.renderLiveToolBody(tc, width); len(body) > 0 {
lines = append(lines, body...)
}
lines = append(lines, toolBoxSide(v.Theme, "", width))
lines = append(lines, toolBoxBottom(v.Theme, width))
return lines
}
@ -627,9 +631,12 @@ func (v *View) renderToolCall(tc ToolCallView, width int) []string {
// Finished tool call with a result body. Top edge embeds the
// label; body lines go through toolBoxSide so each row gets
// vertical edges; bottom edge closes the box.
// vertical edges; bottom edge closes the box. Blank interior
// rows after the top and before the bottom give the body a bit
// of breathing room from the corners.
lines = append(lines, "")
lines = append(lines, toolBoxTop(v.Theme, label, width))
lines = append(lines, toolBoxSide(v.Theme, "", width))
color := v.Theme.ToolOut
if tc.Error {
color = v.Theme.Error
@ -642,6 +649,7 @@ func (v *View) renderToolCall(tc ToolCallView, width int) []string {
}
lines = append(lines, toolBoxSide(v.Theme, l, width))
}
lines = append(lines, toolBoxSide(v.Theme, "", width))
lines = append(lines, toolBoxBottom(v.Theme, width))
return lines
}