fix(components): paint table columns at their measured widths - #265
Merged
Merged
Conversation
53 tasks
LeadcodeDev
force-pushed
the
fix/cascade-reaches-painters
branch
from
September 22, 2026 06:11
6dc5764 to
dc957fe
Compare
LeadcodeDev
force-pushed
the
fix/table-column-widths
branch
from
September 22, 2026 06:12
14fbbe3 to
5b62def
Compare
LeadcodeDev
force-pushed
the
fix/cascade-reaches-painters
branch
from
September 22, 2026 08:36
dc957fe to
42c4881
Compare
LeadcodeDev
force-pushed
the
fix/table-column-widths
branch
from
September 22, 2026 08:36
5b62def to
19e4361
Compare
LeadcodeDev
force-pushed
the
fix/cascade-reaches-painters
branch
from
September 22, 2026 08:46
42c4881 to
5fba6d1
Compare
LeadcodeDev
force-pushed
the
fix/table-column-widths
branch
from
September 22, 2026 08:46
19e4361 to
575be98
Compare
LeadcodeDev
changed the base branch from
fix/cascade-reaches-painters
to
chantier/audit-2026-09
September 22, 2026 08:54
LeadcodeDev
force-pushed
the
fix/table-column-widths
branch
from
September 22, 2026 09:02
575be98 to
c03a977
Compare
`TableIntrinsic::compute_width` (intrinsic.rs:911-949) measures every header and every cell, keeps a per-column max (`col_widths[i] = col_widths[i].max(w + cell_padding * 2.0)`) and returns the **sum**. The painter then throws that per-column distribution away and gives each column `total_w / col_count`. For an uneven table (e.g. headers `["ID", "Description of the incident"]`, natural widths 60px and 400px → intrinsic 460px) the painter allocates 230px per column; the 400px column's text is drawn from `align_text_x` at a position computed against a 230px cell and there is no per-cell clip (table.rs:203-262 draws each cell with `draw_text_with_fallback` and only advances `col_x += cw`), so the text overlaps the neighbouring column or spills past the table's right edge. With `column_align: "right"` it spills backwards into the previous column. The measurer's own doc comment (intrinsic.rs:884-888) asserts the opposite: "Natural size formula (matches the painter exactly) ... otherwise each column gets `max(header_text_width + 2 × cell_padding, min_col_width)`" — the painter implements no such rule, and `compute_width` has no `min_col_width` either. Refs #220
LeadcodeDev
force-pushed
the
fix/table-column-widths
branch
from
September 22, 2026 09:06
c03a977 to
bd2b246
Compare
LeadcodeDev
added a commit
that referenced
this pull request
Sep 22, 2026
`TableIntrinsic::compute_width` (intrinsic.rs:911-949) measures every header and every cell, keeps a per-column max (`col_widths[i] = col_widths[i].max(w + cell_padding * 2.0)`) and returns the **sum**. The painter then throws that per-column distribution away and gives each column `total_w / col_count`. For an uneven table (e.g. headers `["ID", "Description of the incident"]`, natural widths 60px and 400px → intrinsic 460px) the painter allocates 230px per column; the 400px column's text is drawn from `align_text_x` at a position computed against a 230px cell and there is no per-cell clip (table.rs:203-262 draws each cell with `draw_text_with_fallback` and only advances `col_x += cw`), so the text overlaps the neighbouring column or spills past the table's right edge. With `column_align: "right"` it spills backwards into the previous column. The measurer's own doc comment (intrinsic.rs:884-888) asserts the opposite: "Natural size formula (matches the painter exactly) ... otherwise each column gets `max(header_text_width + 2 × cell_padding, min_col_width)`" — the painter implements no such rule, and `compute_width` has no `min_col_width` either. Refs #220
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.
Severity Medium, category correctness. Location:
crates/rustmotion-components/src/table.rs:116Impact
TableIntrinsic::compute_width(intrinsic.rs:911-949) measures every header and every cell, keeps a per-column max (col_widths[i] = col_widths[i].max(w + cell_padding * 2.0)) and returns the sum. The painter then throws that per-column distribution away and gives each columntotal_w / col_count. For an uneven table (e.g. headers["ID", "Description of the incident"], natural widths 60px and 400px → intrinsic 460px) the painter allocates 230px per column; the 400px column's text is drawn fromalign_text_xat a position computed against a 230px cell and there is no per-cell clip (table.rs:203-262 draws each cell withdraw_text_with_fallbackand only advancescol_x += cw), so the text overlaps the neighbouring column or spills past the table's right edge. Withcolumn_align: "right"it spills backwards into the previous column. The measurer's own doc comment (intrinsic.rs:884-888) asserts the opposite: "Natural size formula (matches the painter exactly) ... otherwise each column getsmax(header_text_width + 2 × cell_padding, min_col_width)" — the painter implements no such rule, andcompute_widthhas nomin_col_widtheither.Fix
Extract the per-column width computation into one function on
Table(returningVec<f32>), haveTableIntrinsicsum its result andresolve_column_widthsreturn it directly, scaling proportionally when the laid-out width differs from the natural one. Fix the now-false doc comment at intrinsic.rs:884.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-08).