Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git: Remove panes from SplittableEditor (#48102)
Cole Miller608cc9953f70
diff --git a/crates/editor/src/split.rs b/crates/editor/src/split.rsindex b6c94d8bc37..863342eea91 100644--- a/crates/editor/src/split.rs+++ b/crates/editor/src/split.rs@@ -3,9 +3,7 @@ use std::ops::{Bound, Range};use buffer_diff::{BufferDiff, BufferDiffSnapshot};use collections::HashMap;use feature_flags::{FeatureFlag, FeatureFlagAppExt as _};-use gpui::{- Action, AppContext as _, Entity, EventEmitter, Focusable, NoAction, Subscription, WeakEntity,-};+use gpui::{Action, AppContext as _, Entity, EventEmitter, Focusable, Subscription, WeakEntity};use language::{Buffer, Capability};use multi_buffer::{Anchor, BufferOffset, ExcerptId, ExcerptRange, ExpandExcerptDirection, MultiBuffer,@@ -23,10 +21,7 @@ use crate::{display_map::MultiBufferRowMapping,split_editor_view::{SplitEditorState, SplitEditorView},};-use workspace::{- ActivatePaneLeft, ActivatePaneRight, Item, ItemHandle, Pane, PaneGroup, SplitDirection,- Workspace,-};+use workspace::{ActivatePaneLeft, ActivatePaneRight, Item, Workspace};use crate::{Autoscroll, DisplayMap, Editor, EditorEvent, ToggleCodeActions, ToggleSoftWrap,@@ -273,7 +268,6 @@ pub struct SplittableEditor {rhs_multibuffer: Entity<MultiBuffer>,rhs_editor: Entity<Editor>,lhs: Option<LhsEditor>,- panes: PaneGroup,workspace: WeakEntity<Workspace>,split_state: Entity<SplitEditorState>,locked_cursors: bool,@@ -283,7 +277,6 @@ pub struct SplittableEditor {struct LhsEditor {multibuffer: Entity<MultiBuffer>,editor: Entity<Editor>,- pane: Entity<Pane>,has_latest_selection: bool,_subscriptions: Vec<Subscription>,}@@ -324,22 +317,6 @@ impl SplittableEditor {editor.set_expand_all_diff_hunks(cx);editor});- let pane = cx.new(|cx| {- let mut pane = Pane::new(- workspace.downgrade(),- project,- Default::default(),- None,- NoAction.boxed_clone(),- true,- window,- cx,- );- pane.set_should_display_tab_bar(|_, _| false);- pane.add_item(rhs_editor.boxed_clone(), true, true, None, window, cx);- pane- });- let panes = PaneGroup::new(pane);// TODO(split-diff) we might want to tag editor events with whether they came from rhs/lhslet subscriptions =vec![cx.subscribe(@@ -380,7 +357,6 @@ impl SplittableEditor {rhs_editor,rhs_multibuffer,lhs: None,- panes,workspace: workspace.downgrade(),split_state,locked_cursors: false,@@ -412,28 +388,6 @@ impl SplittableEditor {editor.set_delegate_expand_excerpts(true);editor});- let lhs_pane = cx.new(|cx| {- let mut pane = Pane::new(- workspace.downgrade(),- workspace.read(cx).project().clone(),- Default::default(),- None,- NoAction.boxed_clone(),- true,- window,- cx,- );- pane.set_should_display_tab_bar(|_, _| false);- pane.add_item(- ItemHandle::boxed_clone(&lhs_editor),- false,- false,- None,- window,- cx,- );- pane- });let subscriptions =vec![cx.subscribe(@@ -467,7 +421,6 @@ impl SplittableEditor {let mut lhs = LhsEditor {editor: lhs_editor,multibuffer: lhs_multibuffer,- pane: lhs_pane.clone(),has_latest_selection: false,_subscriptions: subscriptions,};@@ -581,10 +534,6 @@ impl SplittableEditor {self.lhs = Some(lhs);- let rhs_pane = self.panes.first_pane();- self.panes- .split(&rhs_pane, &lhs_pane, SplitDirection::Left, cx)- .unwrap();cx.notify();}@@ -845,7 +794,6 @@ impl SplittableEditor {let Some(lhs) = self.lhs.take() else {return;};- self.panes.remove(&lhs.pane, cx).unwrap();self.rhs_editor.update(cx, |rhs, cx| {let rhs_snapshot = rhs.display_map.update(cx, |dm, cx| dm.snapshot(cx));let native_anchor = rhs.scroll_manager.native_anchor(&rhs_snapshot, cx);