Skip to content

markdown: Fix code block scrollbars flashing on vertical scroll#50817

Merged
MrSubidubi merged 2 commits intozed-industries:mainfrom
cppcoffee:markdown-vertical-scroll
Mar 9, 2026
Merged

markdown: Fix code block scrollbars flashing on vertical scroll#50817
MrSubidubi merged 2 commits intozed-industries:mainfrom
cppcoffee:markdown-vertical-scroll

Conversation

@cppcoffee
Copy link
Copy Markdown
Contributor

@cppcoffee cppcoffee commented Mar 5, 2026

Release Notes:

  • Fixed code block scrollbars flashing on vertical scroll

before:

When there are many code blocks, scrolling through markdown will display a horizontal scrollbar (when the mouse is not inside a code block).

2026-03-05.20.07.57.mov

after:

When scrolling markdown, do not display the horizontal scrollbar when the mouse is not in a code block.

2026-03-05.20.06.27.mov

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 5, 2026
@MrSubidubi MrSubidubi self-assigned this Mar 5, 2026
Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

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

Thank you for this, but I do not think this is the best solution for the issue at hand. I think we should rather check whether we can modify the PartialEq impl for the ScrollbarLayoutState so that this does not happen. I'd suspect we can instead of comparing the entire bounds compare just the size of the bounds, as that should not change. But I think this might be a more sensible fix - the caller should not be bothered with this. What do you think?

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
@cppcoffee cppcoffee closed this Mar 5, 2026
@cppcoffee cppcoffee force-pushed the markdown-vertical-scroll branch from 531e30f to d2f93e6 Compare March 5, 2026 13:27
@cppcoffee cppcoffee reopened this Mar 5, 2026
@cppcoffee
Copy link
Copy Markdown
Contributor Author

Hi @MrSubidubi , You are right. Now, modify the ScrollbarLayout, and the effect is as follows:

2026-03-05.21.28.47.mov

Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

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

This looks much better, thank you!

I am not sure as to whether we need the track bounds or the reserved space here too though - both were not present before. Can we not remove these? IIRC we do not really update these anyway for a thumb layout between frames at least.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
@cppcoffee
Copy link
Copy Markdown
Contributor Author

This looks much better, thank you!

I am not sure as to whether we need the track bounds or the reserved space here too though - both were not present before. Can we not remove these? IIRC we do not really update these anyway for a thumb layout between frames at least.

Good point — I agree, we don’t need track_bounds or reserved_space in this equality check, and I removed both.

Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

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

Nice find and fix, thanks for the follow-ups!

@MrSubidubi MrSubidubi enabled auto-merge (squash) March 9, 2026 23:11
@MrSubidubi MrSubidubi merged commit 7a4aaff into zed-industries:main Mar 9, 2026
28 checks passed
@cppcoffee cppcoffee deleted the markdown-vertical-scroll branch March 10, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants