Skip to content

fix(table): prevent columns from shrinking to zero width#671

Open
taciturnaxolotl wants to merge 1 commit into
mainfrom
fix/table-column-min-width-floor
Open

fix(table): prevent columns from shrinking to zero width#671
taciturnaxolotl wants to merge 1 commit into
mainfrom
fix/table-column-min-width-floor

Conversation

@taciturnaxolotl

Copy link
Copy Markdown
Member

Summary

  • Table column shrink algorithm could allocate zero-width to short columns when sibling columns contained long unbreakable tokens
  • Added a minimum-width floor (xPadding + max(min, 1)) so columns never collapse to invisible
  • Implemented two-pass shrink: first respecting the floor, then unreserved fallback for impossible width budgets (e.g. Width(1))
  • Updated golden files that previously encoded the buggy behavior (blank column headers/cells)

Fixes: charmbracelet/glow#941

Test plan

  • All existing table tests pass
  • Full lipgloss test suite passes
  • Reproduction case from glow#941: Status column and "Y" cells visible at width 80

💘 Generated with Crush

Assisted-by: DeepSeek V4 Pro via Crush crush@charm.land

When a sibling column has long unbreakable tokens, the shrink algorithm
could allocate zero width to short columns, making headers and cell
content invisible. This adds a minimum-width floor (horizontal padding + 1)
and a two-pass shrink strategy: first respecting the floor, then falling
back to unreserved shrinking only when the width budget is impossible.

Fixes: charmbracelet/glow#941

💘 Generated with Crush

Assisted-by: DeepSeek V4 Pro via Crush <crush@charm.land>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table column collapsed to width 0 (header dropped, cells blank) when sibling has long unbreakable tokens

1 participant