From 2163580b16e82c0720b9afd7f880a27e51f84c87 Mon Sep 17 00:00:00 2001 From: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> Date: Tue, 28 Oct 2025 03:00:55 -0400 Subject: [PATCH] Fix tab switcher spacing bug (#41329) The tab switcher render matches calls each workspace item's `Item::tab_content` function that can return an element of variable size. Because the tab switcher was using a uniform list under the hood, this would cause spacing issues when tab_contents elements had different sizes. The fix is by changing the picker to use a material list under the hood. Release Notes: - N/A --- crates/picker/src/picker.rs | 9 +++++++++ crates/tab_switcher/src/tab_switcher.rs | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 90423bcace0ad405e0c88703efe09f39a8763778..d9a23ec93b80287dd1b7b483c8b6315b2119bfd5 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -275,6 +275,15 @@ impl Picker { Self::new(delegate, ContainerKind::UniformList, head, window, cx) } + /// A picker, which displays its matches using `gpui::list`, matches can have different heights. + /// The picker allows the user to perform search items by text. + /// If `PickerDelegate::render_match` only returns items with the same height, use `Picker::uniform_list` as its implementation is optimized for that. + pub fn nonsearchable_list(delegate: D, window: &mut Window, cx: &mut Context) -> Self { + let head = Head::empty(Self::on_empty_head_blur, window, cx); + + Self::new(delegate, ContainerKind::List, head, window, cx) + } + /// A picker, which displays its matches using `gpui::list`, matches can have different heights. /// The picker allows the user to perform search items by text. /// If `PickerDelegate::render_match` only returns items with the same height, use `Picker::uniform_list` as its implementation is optimized for that. diff --git a/crates/tab_switcher/src/tab_switcher.rs b/crates/tab_switcher/src/tab_switcher.rs index 2923ee6dd4b53108f0566a0a298b7fffd7e836ee..8b582796b371dc7e10f1bd72f406064fe6be80d1 100644 --- a/crates/tab_switcher/src/tab_switcher.rs +++ b/crates/tab_switcher/src/tab_switcher.rs @@ -155,9 +155,9 @@ impl TabSwitcher { Self { picker: cx.new(|cx| { if is_global { - Picker::uniform_list(delegate, window, cx) + Picker::list(delegate, window, cx) } else { - Picker::nonsearchable_uniform_list(delegate, window, cx) + Picker::nonsearchable_list(delegate, window, cx) } }), init_modifiers,