Skip to content

Fix calculation of folded table widths#1251

Merged
sirosen merged 1 commit intoglobus:mainfrom
sirosen:fix-column-folding
Feb 26, 2026
Merged

Fix calculation of folded table widths#1251
sirosen merged 1 commit intoglobus:mainfrom
sirosen:fix-column-folding

Conversation

@sirosen
Copy link
Member

@sirosen sirosen commented Feb 26, 2026

The width of a table was being treated as the max width of all of the
rows, with each row independently calculating its width.
This is incorrect. The true value for table width should be the
worst-case width for each column (over all of the rows), summed.

As the min_rendered_width of a Row is not actually useful, that
property has been removed. The functionality is now provided by the
table, which has a calculate_width() method.

A test case confirms that it really finds the "worst" (but correct) width
on a very lopsided two-row table. This incidentally also captures that
the header row is considered in this calculation.


No changelog is included, as this is new functionality not-yet-released.

The width of a table was being treated as the max width of all of the
rows, with each row *independently* calculating its width.
This is incorrect. The true value for table width should be the
worst-case width for each column (over all of the rows), summed.

As the `min_rendered_width` of a Row is not actually useful, that
property has been removed. The functionality is now provided by the
table, which has a `calculate_width()` method.

A test case confirms that it really finds the "worst" (but correct) width
on a very lopsided two-row table. This incidentally also captures that
the header row is considered in this calculation.
@sirosen sirosen requested a review from aaschaer as a code owner February 26, 2026 18:08
@sirosen sirosen added the no-news-is-good-news This change does not require a news file label Feb 26, 2026
@sirosen sirosen merged commit 41ae850 into globus:main Feb 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-news-is-good-news This change does not require a news file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants