From 03fad4b951a28257949db7112a1b06305f8a89ab Mon Sep 17 00:00:00 2001 From: Abul Hossain Khan <140191921+abulgit@users.noreply.github.com> Date: Fri, 14 Nov 2025 01:52:57 +0530 Subject: [PATCH] workspace: Fix pinned tab causing resize loop on adjacent tab (#41884) 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 --------- Co-authored-by: Smit Barmase --- crates/workspace/src/pane.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)