From d22a39f84d4c75d66fc5ebadc9cc80f0727fab12 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Mon, 30 Mar 2026 23:25:03 -0700 Subject: [PATCH] Hide other panels when clicking on sidebar threads (#52804) This PR makes it so that clicking on sidebar threads behaves the same as the "focus agent panel" keybinding, namely it hides zoomed panels and brings focus to the agent panel. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --- crates/sidebar/src/sidebar.rs | 2 +- crates/workspace/src/workspace.rs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index a2e0a50abc02b406a4fba5dd4ed2764295b14c34..6d7be34ab5314c963652f768b5f84ff1896c4a21 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -1999,7 +1999,7 @@ impl Sidebar { cx: &mut App, ) { workspace.update(cx, |workspace, cx| { - workspace.open_panel::(window, cx); + workspace.reveal_panel::(window, cx); }); if let Some(agent_panel) = workspace.read(cx).panel::(cx) { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index e7acf3615e11015eddb2287b67c7edddfbddd622..fe100182ca032e48d569d8a055bb4fa5fd7643d7 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -4187,6 +4187,17 @@ impl Workspace { } } + /// Open the panel of the given type, dismissing any zoomed items that + /// would obscure it (e.g. a zoomed terminal). + pub fn reveal_panel(&mut self, window: &mut Window, cx: &mut Context) { + let dock_position = self.all_docks().iter().find_map(|dock| { + let dock = dock.read(cx); + dock.panel_index_for_type::().map(|_| dock.position()) + }); + self.dismiss_zoomed_items_to_reveal(dock_position, window, cx); + self.open_panel::(window, cx); + } + pub fn close_panel(&self, window: &mut Window, cx: &mut Context) { for dock in self.all_docks().iter() { dock.update(cx, |dock, cx| {