From 2569a252ffb2f48428abaf9114f52f16687cf612 Mon Sep 17 00:00:00 2001 From: Tyler Koenig Date: Thu, 28 May 2026 14:18:32 -0400 Subject: [PATCH] fix(tui): enforce column MaxWidth to prevent lipgloss redistribution lipgloss table with Width(tableWidth) redistributes surplus space across all columns. Adding MaxWidth() caps each column to its computed width. Also dump any remaining surplus into the HISTORY sparkline column. --- internal/tui/tab_sites.go | 4 ++++ internal/tui/table_helpers.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/tui/tab_sites.go b/internal/tui/tab_sites.go index 187aa2b..a4efcf4 100644 --- a/internal/tui/tab_sites.go +++ b/internal/tui/tab_sites.go @@ -439,6 +439,10 @@ func (m Model) computeLayout() tableLayout { widths[i] = w } + if surplus > 0 { + widths[6] += surplus + } + return tableLayout{ nameW: nameW, sparkW: sparkW, diff --git a/internal/tui/table_helpers.go b/internal/tui/table_helpers.go index 0f37e72..86a3a16 100644 --- a/internal/tui/table_helpers.go +++ b/internal/tui/table_helpers.go @@ -51,7 +51,7 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en style = tableSelectedStyle.Foreground(s.GetForeground()) } if col < len(colWidths) && colWidths[col] > 0 { - style = style.Width(colWidths[col]) + style = style.Width(colWidths[col]).MaxWidth(colWidths[col]) } return style } @@ -64,7 +64,7 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en base = tableSelectedStyle } if col < len(colWidths) && colWidths[col] > 0 { - base = base.Width(colWidths[col]) + base = base.Width(colWidths[col]).MaxWidth(colWidths[col]) } return base })