From 8d561d64086a1360e47e335c90d7f530d375ce6f Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 9 May 2023 12:00:09 -0700 Subject: [PATCH 1/3] Make dock not eagerly steal focus from sub items --- crates/gpui/src/app.rs | 19 ++++++++++++++++++- crates/workspace/src/workspace.rs | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index ee12b8bc6a..d5a7a2f3ab 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -3963,6 +3963,15 @@ impl Drop for AnyViewHandle { } } +impl Debug for AnyViewHandle { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyViewHandle") + .field("window_id", &self.window_id) + .field("view_id", &self.view_id) + .finish() + } +} + pub struct AnyModelHandle { model_id: usize, model_type: TypeId, @@ -4072,12 +4081,20 @@ impl AnyWeakModelHandle { } } -#[derive(Debug, Copy)] +#[derive(Copy)] pub struct WeakViewHandle { any_handle: AnyWeakViewHandle, view_type: PhantomData, } +impl Debug for WeakViewHandle { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct(&format!("WeakViewHandle<{}>", type_name::())) + .field("any_handle", &self.any_handle) + .finish() + } +} + impl WeakHandle for WeakViewHandle { fn id(&self) -> usize { self.view_id diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index a57cea526b..e1d4d3c8ac 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1600,8 +1600,9 @@ impl Workspace { }); self.active_item_path_changed(cx); + if &pane == self.dock_pane() { - Dock::show(self, true, cx); + Dock::show(self, false, cx); } else { self.last_active_center_pane = Some(pane.downgrade()); if self.dock.is_anchored_at(DockAnchor::Expanded) { From 6dfb48dbd5dfaba0918bd80b25f61932ecf02dae Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 9 May 2023 12:27:07 -0700 Subject: [PATCH 2/3] Fix center items not being activated when deserialized --- crates/workspace/src/persistence/model.rs | 2 +- crates/workspace/src/workspace.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/workspace/src/persistence/model.rs b/crates/workspace/src/persistence/model.rs index e838d22f0d..a92c369e7a 100644 --- a/crates/workspace/src/persistence/model.rs +++ b/crates/workspace/src/persistence/model.rs @@ -197,7 +197,7 @@ impl SerializedPane { let pane_handle = pane_handle .upgrade(cx) .ok_or_else(|| anyhow!("pane was dropped"))?; - Pane::add_item(workspace, &pane_handle, item_handle, false, false, None, cx); + Pane::add_item(workspace, &pane_handle, item_handle, true, true, None, cx); anyhow::Ok(()) })??; } diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index e1d4d3c8ac..86db62ab69 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2610,7 +2610,7 @@ impl Workspace { Dock::set_dock_position( workspace, serialized_workspace.dock_position, - true, + false, cx, ); }); From 0214228689ab2b8cdc43631d9767015889820907 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 9 May 2023 12:54:53 -0700 Subject: [PATCH 3/3] Fix format --- crates/workspace/src/workspace.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 86db62ab69..2c7836e5df 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1600,7 +1600,6 @@ impl Workspace { }); self.active_item_path_changed(cx); - if &pane == self.dock_pane() { Dock::show(self, false, cx); } else {