From 2fd5c7b09d174398dc88f3493070d9d57da5f9ee Mon Sep 17 00:00:00 2001 From: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> Date: Fri, 6 Mar 2026 16:58:58 +0100 Subject: [PATCH] workspace: Fix dock/panel resizing (#50947) Before the panel resize wouldn't take into account the width of the sidebar and the right dock could push the left dock on resize too. Before you mark this PR as ready for review, make sure that you have: - [ ] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Co-authored-by: Cameron \ Release Notes: - N/A --- crates/workspace/src/workspace.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index b94a7b1091c664502fc7dcad0f753b71951ec423..90f05d07a3a87a53ca25a1dc15da7663a95984a8 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -7085,7 +7085,17 @@ impl Workspace { } fn resize_left_dock(&mut self, new_size: Pixels, window: &mut Window, cx: &mut App) { - let size = new_size.min(self.bounds.right() - RESIZE_HANDLE_SIZE); + let workspace_width = self.bounds.size.width; + let mut size = new_size.min(workspace_width - RESIZE_HANDLE_SIZE); + + self.right_dock.read_with(cx, |right_dock, cx| { + let right_dock_size = right_dock + .active_panel_size(window, cx) + .unwrap_or(Pixels::ZERO); + if right_dock_size + size > workspace_width { + size = workspace_width - right_dock_size + } + }); self.left_dock.update(cx, |left_dock, cx| { if WorkspaceSettings::get_global(cx) @@ -7100,13 +7110,14 @@ impl Workspace { } fn resize_right_dock(&mut self, new_size: Pixels, window: &mut Window, cx: &mut App) { - let mut size = new_size.max(self.bounds.left() - RESIZE_HANDLE_SIZE); + let workspace_width = self.bounds.size.width; + let mut size = new_size.min(workspace_width - RESIZE_HANDLE_SIZE); self.left_dock.read_with(cx, |left_dock, cx| { let left_dock_size = left_dock .active_panel_size(window, cx) .unwrap_or(Pixels::ZERO); - if left_dock_size + size > self.bounds.right() { - size = self.bounds.right() - left_dock_size + if left_dock_size + size > workspace_width { + size = workspace_width - left_dock_size } }); self.right_dock.update(cx, |right_dock, cx| { @@ -7667,6 +7678,7 @@ impl Render for Workspace { { workspace.previous_dock_drag_coordinates = Some(e.event.position); + match e.drag(cx).0 { DockPosition::Left => { workspace.resize_left_dock(