diff options
Diffstat (limited to 'internal/ui')
| -rw-r--r-- | internal/ui/table.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go index 8a056fb..437c445 100644 --- a/internal/ui/table.go +++ b/internal/ui/table.go @@ -38,6 +38,13 @@ type Table struct { Rows [][]string } +// FitWidths shrinks colWidths in place so their sum fits budget, using the +// same fair-share algorithm Table.Render uses. Exported so callers that +// pre-wrap cells can size them consistently instead of reimplementing it. +func FitWidths(colWidths []int, budget int) { + rebalanceWidths(colWidths, budget) +} + // rebalanceWidths shrinks column widths in place so their sum fits budget. // Rather than crushing only the last column, every column wider than the // fair share (budget/nCols) is capped first, then columns are trimmed one |
