-
Notifications
You must be signed in to change notification settings - Fork 537
markdown table cells do not wrap and can overflow horizontally #2197
Description
Description
Markdown table cells can overflow horizontally instead of wrapping inside the cell.
I hit this in an app that renders markdown via TextView::markdown(...). Normal paragraph text wraps correctly, but once the content is inside a markdown table cell, long Chinese/English mixed text stays on a single line and pushes the row beyond the container width.
This looks like a bug in the markdown table renderer in crates/ui/src/text/node.rs, not in app-level usage.
Environment
- GPUI: v0.2.2
- GPUI Component: v0.5.1
- Platform: macOS
Steps to Reproduce
- Render markdown with
TextView::markdown(...). - Include a table with one short first column and one long second column.
- Put long natural-language text in the second column.
- View the rendered table in a constrained-width container.
Example markdown:
| Framework | Detection Pattern |
| --- | --- |
| React | useEffect without cleanup return, addEventListener without removeEventListener, setInterval/setTimeout without cleanup, subscribe() without unsubscribe() |
| Vue | onMounted without matching onUnmounted cleanup, watch/watchEffect without stop handle, manual addEventListener inside setup without removal |Screenshots
Expected
Table cells should wrap text within the available cell width, similar to normal paragraph rendering.
Actual
The table renderer sets a width using relative(len as f32) where len is derived from text length, and also applies .truncate() on each cell. This makes cells behave like fixed/non-wrapping content and causes horizontal overflow for long cell text.
Relevant code:
crates/ui/src/text/node.rsdiv().w(Length::Definite(relative(len as f32))).truncate()
From inspection:
.truncate()disables wrapping by applyingwhitespace_nowraprelative(...)expects a fraction of parent width, but here it receives character-count-like values (len as f32), not a0.0..=1.0ratio
So the issue appears to be in gpui-component's markdown table layout logic.