Skip to content

Conversation

@abulgit
Copy link

@abulgit abulgit commented Nov 4, 2025

Closes #41467

My first PR in Zed, any guidance or tips are appreciated.

This fixes the flickering/resize loop that occurred on the tab immediately to the right of a pinned tab.

Removed the conditional border on the pinned tabs container. The border was a visual indicator to show when unpinned tabs were scrolled, but it wasn't essential and was causing the layout thrashing.

Release Notes:

  • Fixed

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 4, 2025
Copy link
Member

@smitbarmase smitbarmase left a comment

Choose a reason for hiding this comment

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

I don't think this is the right way to handle this. This code is essential to add border when there are large amount of unpinned tabs and are scrolled.

Since this PR results in something like this:

Image

I'm not able to reproduce this issue, but can you inspect is_scrollable and is_scrolled bool and figure which one of them is flipping on alternate renders?

We might have to go deeper in checking if tab_bar_scroll_handle.offset().x is flipping to 0 every once in a while or is ittab_bar_scroll_handle.max_offset().width.

@abulgit
Copy link
Author

abulgit commented Nov 4, 2025

Thank you so much @smitbarmase for guiding me to tackle this issue.
So I added some debug logging to see what was happening. Turns out both values were flipping, but the root cause was max_offset toggling between 0px and 0.8px.

Here's my observation from logs

When no border: max_offset=0.8px -> is_scrollable=true -> border gets added
When border added: available space shrinks -> max_offset=0px -> is_scrollable=false -> border removed ->
and it repeats forever

The 0.8px difference is smaller than the border width, so it creates a loop.

So I changed the scrollability check from !max_scroll.is_zero() to max_scroll > px(2.0). This ignores tiny subpixel differences while still showing the border when tabs are actually scrollable. and it works!

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.

Pinned tab causes resize loop on tab to its right

3 participants