Fix calculation of folded table widths#1251
Merged
sirosen merged 1 commit intoglobus:mainfrom Feb 26, 2026
Merged
Conversation
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.
derek-globus
approved these changes
Feb 26, 2026
aaschaer
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_widthof a Row is not actually useful, thatproperty 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.