on main help sign in
fix(ui): padding in the view (#2107)

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

commitfd35a87b4c1621b3b1338fd95930756f7990a4eb authorCarlos Alexandro Becker <caarlos0@users.noreply.github.com> dateTue 3 Feb 2026, 16:55 (8 months ago) parent8d6384e
2 files changed+5−7
internal/ui/chat/tools.go+4−6 internal/ui/styles/styles.go+1−1
internal/ui/chat/tools.go+4−6
@@ -588,19 +588,17 @@ func toolOutputCodeContent(sty *styles.Styles, path, content string, offset, wid
588588 numFmt := fmt.Sprintf("%%%dd", maxDigits)
589589
590590 bodyWidth := width - toolBodyLeftPaddingTotal
591− codeWidth := bodyWidth - maxDigits - 4 // -4 for line number padding
591+ codeWidth := bodyWidth - maxDigits
592592
593593 var out []string
594594 for i, ln := range highlightedLines {
595595 lineNum := sty.Tool.ContentLineNumber.Render(fmt.Sprintf(numFmt, i+1+offset))
596596
597− if lipgloss.Width(ln) > codeWidth {
598− ln = ansi.Truncate(ln, codeWidth, "…")
599− }
597+ // Truncate accounting for padding that will be added.
598+ ln = ansi.Truncate(ln, codeWidth-sty.Tool.ContentCodeLine.GetHorizontalPadding(), "…")
600599
601600 codeLine := sty.Tool.ContentCodeLine.
602601 Width(codeWidth).
603− PaddingLeft(2).
604602 Render(ln)
605603
606604 out = append(out, lipgloss.JoinHorizontal(lipgloss.Left, lineNum, codeLine))
@@ -609,7 +607,7 @@ func toolOutputCodeContent(sty *styles.Styles, path, content string, offset, wid
609607 // Add truncation message if needed.
610608 if len(lines) > maxLines && !expanded {
611609 out = append(out, sty.Tool.ContentCodeTruncation.
612− Width(bodyWidth).
610+ Width(width).
613611 Render(fmt.Sprintf(assistantMessageTruncateFormat, len(lines)-maxLines)),
614612 )
615613 }
internal/ui/styles/styles.go+1−1
@@ -1115,7 +1115,7 @@ func DefaultStyles() Styles {
11151115 // Content rendering - prepared styles that accept width parameter
11161116 s.Tool.ContentLine = s.Muted.Background(bgBaseLighter)
11171117 s.Tool.ContentTruncation = s.Muted.Background(bgBaseLighter)
1118− s.Tool.ContentCodeLine = s.Base.Background(bgBase)
1118+ s.Tool.ContentCodeLine = s.Base.Background(bgBase).PaddingLeft(2)
11191119 s.Tool.ContentCodeTruncation = s.Muted.Background(bgBase).PaddingLeft(2)
11201120 s.Tool.ContentCodeBg = bgBase
11211121 s.Tool.Body = base.PaddingLeft(2)