diff options
Diffstat (limited to 'internal/game/casino_house_edge.go')
| -rw-r--r-- | internal/game/casino_house_edge.go | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/internal/game/casino_house_edge.go b/internal/game/casino_house_edge.go index de0036b..ff3ce59 100644 --- a/internal/game/casino_house_edge.go +++ b/internal/game/casino_house_edge.go @@ -158,19 +158,9 @@ func (g *Game) showCasinoListTable(sess *net.Session, betHeader string, rows []c } } budget := max(len(headers), width-3*len(headers)-1) - for { - sum, widest := 0, 0 - for i, w := range widths { - sum += w - if w > widths[widest] { - widest = i - } - } - if sum <= budget || widths[widest] <= 1 { - break - } - widths[widest]-- - } + // Size the pre-wrapped cells with the same shrink algorithm Table.Render + // uses, instead of a second copy that can disagree on which column yields. + ui.FitWidths(widths, budget) table := ui.Table{} // Headers wrap too, so narrow terminals never lose a column label. all := append([][]string{headers}, cells...) |
