Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Don't grow agent panel to fill entire center (#52380)
Max Brunsfelda6fa2d403429
diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rsindex 7e86a5a8a33..459f7a69717 100644--- a/crates/workspace/src/dock.rs+++ b/crates/workspace/src/dock.rs@@ -1017,7 +1017,7 @@ pub(crate) fn resolve_panel_size(if position.axis() == Axis::Horizontal && panel.supports_flexible_size(window, cx) {let ratio = size_state.flexible_size_ratio- .or_else(|| workspace.default_flexible_dock_ratio(position, cx));+ .or_else(|| workspace.default_flexible_dock_ratio(position));if let Some(ratio) = ratio {return workspacediff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 52c84b82a46..4dc3599db3e 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -2261,20 +2261,11 @@ impl Workspace {Some((workspace_width - opposite_width).max(RESIZE_HANDLE_SIZE))}- pub fn default_flexible_dock_ratio(&self, position: DockPosition, cx: &App) -> Option<f32> {+ pub fn default_flexible_dock_ratio(&self, position: DockPosition) -> Option<f32> {if position.axis() != Axis::Horizontal {return None;}- if self- .center- .panes()- .iter()- .all(|pane| pane.read(cx).items_len() == 0)- {- return Some(1.0);- }-let pane = self.last_active_center_pane.clone()?.upgrade()?;let pane_fraction = self.center.width_fraction_for_pane(&pane).unwrap_or(1.0);Some((pane_fraction / (1.0 + pane_fraction)).clamp(0.0, 1.0))@@ -12268,15 +12259,6 @@ mod tests {let panel = cx.new(|cx| TestPanel::new_flexible(DockPosition::Right, 100, cx));workspace.add_panel(panel, window, cx);workspace.toggle_dock(DockPosition::Right, window, cx);-- let dock = workspace.right_dock().read(cx);- let workspace_width = workspace.bounds.size.width;- let expanded_width = dock- .active_panel()- .map(|panel| workspace.resolved_dock_panel_size(&dock, panel.as_ref(), window, cx))- .expect("flexible dock should fill the center when there are no tabs");-- assert_eq!(expanded_width, workspace_width);});let (panel, resized_width, ratio_basis_width) =