mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 15:40:29 +01:00
e314c023b3
Summary Add a new grid_cols_max_content GPUI styling API that uses minmax(0, max-content) for grid column sizing. This allows columns to automatically size based on their content width while remaining responsive when the container shrinks. Applied the fix to both markdown preview (markdown_renderer.rs) and agent panel (markdown.rs) table rendering. Table borders now wrap tightly around content instead of stretching to full container width. Fixes #50044 Approach A new grid_cols_max_content API is added (as discussed with @MikaylaMaki): style.rs — New grid_cols_max_content: Option<u16> field styled.rs — New .grid_cols_max_content(cols) builder method taffy.rs — New to_grid_repeat_max_content() using minmax(0, max-content) markdown_renderer.rs — Swapped .grid_cols() → .grid_cols_max_content(), moved border to grid div, wrapped in v_flex().items_start() so border hugs content markdown.rs — Applied same fix for agent panel tables: grid_cols_max_content, border on grid div, wrapped in div().flex().flex_col().items_start() container Screenshots Before (equal-width columns, border stretches full width): <img width="1386" height="890" alt="Screenshot 2026-03-06 at 2 17 54 PM" src="https://github.com/user-attachments/assets/42cf76c4-6eba-4919-9b16-78c7fc823315" /> <img width="2555" height="1308" alt="original issue" src="https://github.com/user-attachments/assets/22b0fc02-5203-48bb-8f03-7aa8255197cc" /> After — Markdown Preview and Agent Panel <img width="2554" height="1317" alt="Screenshot 2026-03-07 at 2 29 28 PM" src="https://github.com/user-attachments/assets/8849988e-9ba8-4388-9c29-a255e0ecc52b" /> Before you mark this PR as ready for review, make sure that you have: Added a solid test coverage and/or screenshots from doing manual testing Done a self-review taking into account security and performance aspects Aligned any UI changes with the UI checklist Release Notes: Fixed markdown table columns to use content-based auto-width instead of equal-width distribution in both markdown preview and agent panel (#50044). --------- Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>