From c487a8eb26bef24673017a67d840c4d9bbb64cde Mon Sep 17 00:00:00 2001 From: Tyler Koenig Date: Thu, 28 May 2026 15:57:33 -0400 Subject: [PATCH] fix(tui): compute table Width from column sum, not terminal width Table Width was set to terminal width, forcing lipgloss to redistribute surplus space into columns like #. Now computed from sum of column widths + border overhead. Table is exactly as wide as needed, capped at terminal. --- internal/tui/table_helpers.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/tui/table_helpers.go b/internal/tui/table_helpers.go index 175ca30..8b9f2d4 100644 --- a/internal/tui/table_helpers.go +++ b/internal/tui/table_helpers.go @@ -34,7 +34,16 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en selectedVisual := m.cursor - m.tableOffset rows := buildRows(m.tableOffset, end) - tableWidth := m.termWidth - chromePadH - 2 + colTotal := 0 + for _, w := range colWidths { + colTotal += w + } + borderOverhead := 2 + len(colWidths) - 1 + tableWidth := colTotal + borderOverhead + maxWidth := m.termWidth - chromePadH - 2 + if tableWidth > maxWidth { + tableWidth = maxWidth + } if tableWidth < 40 { tableWidth = 40 }