Updated is_child() to omit self
This commit is contained in:
parent
3a4f8d267a
commit
34388a1d31
2 changed files with 4 additions and 3 deletions
|
@ -1431,8 +1431,8 @@ impl MutableAppContext {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an iterator over all of the view ids from the passed view up to the root of the window
|
/// 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
|
/// Includes the passed view itself
|
||||||
fn ancestors(&self, window_id: usize, mut view_id: usize) -> impl Iterator<Item = usize> + '_ {
|
fn ancestors(&self, window_id: usize, mut view_id: usize) -> impl Iterator<Item = usize> + '_ {
|
||||||
std::iter::once(view_id)
|
std::iter::once(view_id)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -3695,6 +3695,7 @@ impl<'a, T: View> ViewContext<'a, T> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
self.ancestors(view.window_id, view.view_id)
|
self.ancestors(view.window_id, view.view_id)
|
||||||
|
.skip(1) // Skip self id
|
||||||
.any(|parent| parent == self.view_id)
|
.any(|parent| parent == self.view_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2542,7 +2542,7 @@ impl View for Workspace {
|
||||||
} else {
|
} else {
|
||||||
for pane in self.panes() {
|
for pane in self.panes() {
|
||||||
let view = view.clone();
|
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);
|
self.handle_pane_focused(pane.clone(), cx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue