fix(tui): renderer: line wrapping in chat

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.
This commit is contained in:
Ayman Bagabas
2025-07-22 09:57:58 -04:00
parent a8ec22f012
commit 82a34c708a

View File

@@ -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.