Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
workspace: Fix pinned tab causing resize loop on adjacent tab (#41884)
Abul Hossain Khan03fad4b951a2
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rsindex 1f950460299..dcfd634dfd3 100644--- a/crates/workspace/src/pane.rs+++ b/crates/workspace/src/pane.rs@@ -19,7 +19,7 @@ use futures::{StreamExt, stream::FuturesUnordered};use gpui::{Action, AnyElement, App, AsyncWindowContext, ClickEvent, ClipboardItem, Context, Corner, Div,DragMoveEvent, Entity, EntityId, EventEmitter, ExternalPaths, FocusHandle, FocusOutEvent,- Focusable, IsZero, KeyContext, MouseButton, MouseDownEvent, NavigationDirection, Pixels, Point,+ Focusable, KeyContext, MouseButton, MouseDownEvent, NavigationDirection, Pixels, Point,PromptLevel, Render, ScrollHandle, Subscription, Task, WeakEntity, WeakFocusHandle, Window,actions, anchored, deferred, prelude::*,};@@ -3074,6 +3074,7 @@ impl Pane {}let unpinned_tabs = tab_items.split_off(self.pinned_tab_count);let pinned_tabs = tab_items;+TabBar::new("tab_bar").when(self.display_nav_history_buttons.unwrap_or_default(),@@ -3097,8 +3098,10 @@ impl Pane {.children(pinned_tabs.len().ne(&0).then(|| {let max_scroll = self.tab_bar_scroll_handle.max_offset().width;// We need to check both because offset returns delta values even when the scroll handle is not scrollable- let is_scrollable = !max_scroll.is_zero();let is_scrolled = self.tab_bar_scroll_handle.offset().x < px(0.);+ // Avoid flickering when max_offset is very small (< 2px).+ // The border adds 1-2px which can push max_offset back to 0, creating a loop.+ let is_scrollable = max_scroll > px(2.0);let has_active_unpinned_tab = self.active_item_index >= self.pinned_tab_count;h_flex().children(pinned_tabs)