Make Markdown tables responsive like Notion#16
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f50d6b1551
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (index, (cell, state)) in self.cells.iter_mut().zip(&mut tree.children).enumerate() { | ||
| let column = index % columns; | ||
| let node = cell | ||
| .as_widget_mut() | ||
| .layout(state, renderer, &measure_limits); | ||
| column_widths[column] = | ||
| column_widths[column].max(node.size().width.min(Self::MAX_COLUMN_WIDTH)); |
There was a problem hiding this comment.
Avoid measuring Fill cells at infinite width
When a table has three or more nonempty columns, the horizontal scrollable supplies an unbounded maximum width (as the comment below notes), but each measured cell is a container(...).width(Length::Fill). That first layout therefore reports an infinite cell width, which this line reduces to MAX_COLUMN_WIDTH; every nonempty column becomes 320 px regardless of its content. For example, a three-column table with single-character headers is rendered at 962 px and horizontally scrolls in the normal 780 px reading column instead of fitting it. Measure a shrink-wrapped version of each cell (or its child) in this pass, then apply the fill cell wrapper only in the fixed-column layout pass.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Root cause
The previous row/cell layout let cell content determine isolated widget bounds, which caused long content to paint outside its cell and left row backgrounds visually incomplete. The new adaptive layout measures columns together and lays every cell out against the same column widths.
Validation
cargo checkcargo test --lib(321 passed)cargo test --tests(all passed)cargo build --release --bin rmdvrustfmt --edition 2021 --check src/app.rs src/render.rsgit diff --checkUnrelated existing documentation changes in the worktree were intentionally left out of this PR.