From 34388a1d315554006f93bbacf07cca34b8626871 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 9 Dec 2022 12:07:49 -0800 Subject: [PATCH] Updated is_child() to omit self --- crates/gpui/src/app.rs | 5 +++-- crates/workspace/src/workspace.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index bf783999148c68466b3e4da8f802da22fb82617a..f5ced700b63c370814caa4b538c99366d654395f 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1431,8 +1431,8 @@ impl MutableAppContext { true } - // Returns an iterator over all of the view ids from the passed view up to the root of the window - // Includes the passed view itself + /// Returns an iterator over all of the view ids from the passed view up to the root of the window + /// Includes the passed view itself fn ancestors(&self, window_id: usize, mut view_id: usize) -> impl Iterator + '_ { std::iter::once(view_id) .into_iter() @@ -3695,6 +3695,7 @@ impl<'a, T: View> ViewContext<'a, T> { return false; } self.ancestors(view.window_id, view.view_id) + .skip(1) // Skip self id .any(|parent| parent == self.view_id) } diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 6dd5c9c4fa31ce18cb7cd7ebea75058b029a2c42..7dc8ddab067e46de209cb5ad7b1a480775a14369 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2542,7 +2542,7 @@ impl View for Workspace { } else { for pane in self.panes() { let view = view.clone(); - if pane.update(cx, |_, cx| cx.is_child(view)) { + if pane.update(cx, |_, cx| view.id() == cx.view_id() || cx.is_child(view)) { self.handle_pane_focused(pane.clone(), cx); break; }