Skip to content

Commit 302d032

Browse files
committed
Fix empty lines in tools dialog from multiline descriptions
Use only the first line of tool descriptions to prevent newlines from rendering as blank lines in the tool list. Assisted-By: docker-agent
1 parent 9de6070 commit 302d032

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/tui/dialog/tools.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ func (d *toolsDialog) renderLines(contentWidth, _ int) []string {
6868
}
6969

7070
name := lipgloss.NewStyle().Foreground(styles.Highlight).Render(" " + t.DisplayName())
71-
if t.Description != "" {
71+
if desc, _, _ := strings.Cut(t.Description, "\n"); desc != "" {
7272
separator := " • "
7373
separatorWidth := lipgloss.Width(separator)
7474
nameWidth := lipgloss.Width(name)
7575
availableWidth := contentWidth - nameWidth - separatorWidth
7676
if availableWidth > 0 {
77-
desc := toolcommon.TruncateText(t.Description, availableWidth)
78-
name += styles.MutedStyle.Render(separator + desc)
77+
truncated := toolcommon.TruncateText(desc, availableWidth)
78+
name += styles.MutedStyle.Render(separator + truncated)
7979
}
8080
}
8181
lines = append(lines, name)

0 commit comments

Comments
 (0)