diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 1f950460299443187457275185d3a28763b11166..dcfd634dfd37c7e5a078f9cef862acf333c84a2a 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)