fix(tui): renderer: line wrapping in chat
Ayman Bagabas
created 5 months ago
This fixes an issue where the tool call in nested headers don't wrap
correctly when the tool name is long. The tool name is now rendered
without an extra trailing space, and the parameter list is rendered with
the correct width calculation.
Change summary
internal/tui/components/chat/messages/renderer.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Detailed changes
@@ -124,9 +124,9 @@ func (br baseRenderer) makeNestedHeader(v *toolCallCmp, tool string, width int,
} else if v.cancelled {
icon = t.S().Muted.Render(styles.ToolPending)
}
- tool = t.S().Base.Foreground(t.FgHalfMuted).Render(tool) + " "
+ tool = t.S().Base.Foreground(t.FgHalfMuted).Render(tool)
prefix := fmt.Sprintf("%s %s ", icon, tool)
- return prefix + renderParamList(true, width-lipgloss.Width(tool), params...)
+ return prefix + renderParamList(true, width-lipgloss.Width(prefix), params...)
}
// makeHeader builds "<Tool>: param (key=value)" and truncates as needed.