Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add bound checks for resizing right dock (#32246)

smaster54b4587f9a21
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index adf16c09103..33d1d74d4ef 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -6255,7 +6255,15 @@ fn resize_right_dock(
window: &mut Window,
cx: &mut App,
) {
- let size = new_size.max(workspace.bounds.left() - RESIZE_HANDLE_SIZE);
+ let mut size = new_size.max(workspace.bounds.left() - RESIZE_HANDLE_SIZE);
+ workspace.left_dock.read_with(cx, |left_dock, cx| {
+ let left_dock_size = left_dock
+ .active_panel_size(window, cx)
+ .unwrap_or(Pixels(0.0));
+ if left_dock_size + size > workspace.bounds.right() {
+ size = workspace.bounds.right() - left_dock_size
+ }
+ });
workspace.right_dock.update(cx, |right_dock, cx| {
if WorkspaceSettings::get_global(cx)
.resize_all_panels_in_dock