Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Restore the active pane magnification feature
Mikayla51caa743495e
diff --git a/crates/workspace/src/pane_group.rs b/crates/workspace/src/pane_group.rsindex 4428e42830b..68fd3c084f5 100644--- a/crates/workspace/src/pane_group.rs+++ b/crates/workspace/src/pane_group.rs@@ -579,12 +579,15 @@ mod element {Size, Style, WeakView, WindowContext,};use parking_lot::Mutex;+ use settings::Settings;use smallvec::SmallVec;use ui::prelude::*;use util::ResultExt;use crate::Workspace;+ use crate::WorkspaceSettings;+use super::{HANDLE_HITBOX_SIZE, HORIZONTAL_MIN_SIZE, VERTICAL_MIN_SIZE};const DIVIDER_SIZE: f32 = 1.0;@@ -834,20 +837,39 @@ mod element {debug_assert!(flexes.len() == len);debug_assert!(flex_values_in_bounds(flexes.as_slice()));+ let magnification_value = WorkspaceSettings::get(None, cx).active_pane_magnification;+ let active_pane_magnification = if magnification_value == 1. {+ None+ } else {+ Some(magnification_value)+ };++ let total_flex = if let Some(flex) = active_pane_magnification {+ self.children.len() as f32 - 1. + flex+ } else {+ len as f32+ };+let mut origin = bounds.origin;- let space_per_flex = bounds.size.along(self.axis) / len as f32;+ let space_per_flex = bounds.size.along(self.axis) / total_flex;let mut bounding_boxes = self.bounding_boxes.lock();bounding_boxes.clear();for (ix, child) in self.children.iter_mut().enumerate() {- //todo!(active_pane_magnification)- // If using active pane magnification, need to switch to using- // 1 for all non-active panes, and then the magnification for the- // active pane.+ let child_flex = active_pane_magnification+ .map(|magnification| {+ if self.active_pane_ix == Some(ix) {+ magnification+ } else {+ 1.+ }+ })+ .unwrap_or_else(|| flexes[ix]);+let child_size = bounds.size- .apply_along(self.axis, |_| space_per_flex * flexes[ix]);+ .apply_along(self.axis, |_| space_per_flex * child_flex);let child_bounds = Bounds {origin,@@ -857,20 +879,23 @@ mod element {cx.with_z_index(0, |cx| {child.draw(origin, child_size.into(), cx);});- cx.with_z_index(1, |cx| {- if ix < len - 1 {- Self::push_handle(- self.flexes.clone(),- state.clone(),- self.axis,- ix,- child_bounds,- bounds,- self.workspace.clone(),- cx,- );- }- });++ if active_pane_magnification.is_none() {+ cx.with_z_index(1, |cx| {+ if ix < len - 1 {+ Self::push_handle(+ self.flexes.clone(),+ state.clone(),+ self.axis,+ ix,+ child_bounds,+ bounds,+ self.workspace.clone(),+ cx,+ );+ }+ });+ }origin = origin.apply_along(self.axis, |val| val + child_size.along(self.axis));}