Skip to content

markdown_preview: Shrink preview to fit when pane toolbar grows#55009

Merged
agu-z merged 4 commits into
zed-industries:mainfrom
tkilaker:markdown_preview-pane-fit
May 15, 2026
Merged

markdown_preview: Shrink preview to fit when pane toolbar grows#55009
agu-z merged 4 commits into
zed-industries:mainfrom
tkilaker:markdown_preview-pane-fit

Conversation

@tkilaker

Copy link
Copy Markdown
Contributor

Summary

  • Changes the outer MarkdownPreviewView div from .size_full() to .w_full().flex_1().min_h_0().
  • Before: preview's height stayed at 100% of the pane regardless of toolbar size, so deploying the buffer search bar pushed the preview's bottom 45px past the pane edge — clipped by the pane's overflow_hidden.
  • After: preview takes only the leftover main-axis space and shrinks as the toolbar grows. Bottom edge stays at the pane bottom.

Verified empirically: bounds.size.height round-trips 952px ↔ 907px with the toolbar at 67 ↔ 112 (Δ = 45px = the search bar's height).

Companion to #55008 (anchor compensation). Both PRs come out of investigating #54987 — they fix two independent bugs that surface together when toggling the search bar.

Test plan

  • Compiles with cargo clippy -p markdown_preview -- --deny warnings.
  • Manual: Cmd-F in the markdown preview no longer clips bottom content past the pane edge.
  • Manual: Esc restores the preview to full available height.

Release Notes:

  • Fixed markdown preview content being clipped past the pane edge when the buffer search bar is open

The outer `MarkdownPreviewView` div used `.size_full()`, so its height
stayed at 100% of the pane regardless of the toolbar size. When the
buffer search bar deployed, the toolbar grew by ~45px and the preview's
bottom extended past the pane bottom, getting clipped by the pane's
`overflow_hidden`.

Switching to `.w_full().flex_1().min_h_0()` lets the preview take only
the leftover main-axis space and shrink as the toolbar grows. After the
fix, `bounds.size.height` round-trips `952px ↔ 907px` with the toolbar
at `67 ↔ 112`, matching the available pane area.
@cla-bot

cla-bot Bot commented Apr 27, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @tkilaker on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Apr 27, 2026
@tkilaker

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 27, 2026
@cla-bot

cla-bot Bot commented Apr 27, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@SomeoneToIgnore SomeoneToIgnore added the area:preview/markdown Feedback for Zed's Markdown preview label May 4, 2026
@agu-z agu-z self-requested a review May 15, 2026 22:34
@agu-z agu-z self-assigned this May 15, 2026

@agu-z agu-z left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you for your contribution

@agu-z agu-z enabled auto-merge May 15, 2026 22:47
@agu-z agu-z added this pull request to the merge queue May 15, 2026
Merged via the queue into zed-industries:main with commit bebe730 May 15, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:preview/markdown Feedback for Zed's Markdown preview cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants