diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index 62655a90639..8bac0fcefde 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -1046,8 +1046,9 @@ impl Dock { dispatch_context } - pub fn clamp_panel_size(&mut self, max_size: Pixels, window: &Window, cx: &mut App) { + pub fn clamp_panel_size(&mut self, max_size: Pixels, window: &Window, cx: &mut Context) { let max_size = (max_size - RESIZE_HANDLE_SIZE).abs(); + let mut clamped = false; for entry in &mut self.panel_entries { let use_flexible = entry.panel.has_flexible_size(window, cx); if use_flexible { @@ -1060,8 +1061,12 @@ impl Dock { .unwrap_or_else(|| entry.panel.default_size(window, cx)); if size > max_size { entry.size_state.size = Some(max_size.max(RESIZE_HANDLE_SIZE)); + clamped = true; } } + if clamped { + cx.notify(); + } } pub(crate) fn load_persisted_size_state( diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 3cd02c1599b..7d1e3384dc6 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -7817,6 +7817,12 @@ impl Workspace { .and_then(|state| state.size) .unwrap_or_else(|| panel.default_size(window, cx)); container = container.w(size); + // Allow the fixed-width dock to shrink when there isn't + // enough space (e.g. when the sidebar is open). The + // stored size is preserved so the dock expands back + // when space becomes available. + let style = container.style(); + style.flex_shrink = Some(1.0); } if let Some(min) = min_size { container = container.min_w(min);