From 8f61134e7ea4e13bb099fa9205baef23135885e9 Mon Sep 17 00:00:00 2001 From: Petros Amoiridis Date: Thu, 2 Feb 2023 20:11:07 +0200 Subject: [PATCH 1/2] Allow comparing ViewHandle to AnyViewHandle Since they both have a window_id and a view_id. Co-Authored-By: Antonio Scandurra --- crates/gpui/src/app.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 95967ed48588acc2193e41ad597a5a2bb1ac0021..a72f7fc5c28b63f31c7f722de29766dc44037204 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -4915,6 +4915,12 @@ impl From> for AnyViewHandle { } } +impl PartialEq> for AnyViewHandle { + fn eq(&self, other: &ViewHandle) -> bool { + self.window_id == other.window_id && self.view_id == other.view_id + } +} + impl Drop for AnyViewHandle { fn drop(&mut self) { self.ref_counts From 2b0592da2137873870e6885e6acf7f14640c7c0a Mon Sep 17 00:00:00 2001 From: Petros Amoiridis Date: Thu, 2 Feb 2023 20:14:24 +0200 Subject: [PATCH 2/2] Guard against tab_bar_context_menu We don't want to have the tab_bar_context_menu as the active item of the pane where the split started from Co-Authored-By: Antonio Scandurra --- crates/workspace/src/pane.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 7e56b864bfa5813ab6ed1f58174e8a3c4a0bb5e2..cc1d8f0ad21a22588c76e00f594350b67c6b8314 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1527,7 +1527,7 @@ impl View for Pane { } cx.focus(active_item); - } else { + } else if focused != self.tab_bar_context_menu { self.last_focused_view_by_item .insert(active_item.id(), focused.downgrade()); }