Compute view ancestry at layout time

This commit is contained in:
Antonio Scandurra
2023-05-03 16:36:14 +02:00
parent 7f345f8bf5
commit 7f137ed3dd
18 changed files with 246 additions and 225 deletions
+3 -5
View File
@@ -670,13 +670,11 @@ mod tests {
cx,
)
});
let (_, root_view) = cx.add_window(|_| EmptyView);
let (window_id, _root_view) = cx.add_window(|_| EmptyView);
let editor = cx.add_view(&root_view, |cx| {
Editor::for_buffer(buffer.clone(), None, cx)
});
let editor = cx.add_view(window_id, |cx| Editor::for_buffer(buffer.clone(), None, cx));
let search_bar = cx.add_view(&root_view, |cx| {
let search_bar = cx.add_view(window_id, |cx| {
let mut search_bar = BufferSearchBar::new(cx);
search_bar.set_active_pane_item(Some(&editor), cx);
search_bar.show(false, true, cx);
-2
View File
@@ -939,8 +939,6 @@ impl ToolbarItemView for ProjectSearchBar {
self.subscription = None;
self.active_project_search = None;
if let Some(search) = active_pane_item.and_then(|i| i.downcast::<ProjectSearchView>()) {
let query_editor = search.read(cx).query_editor.clone();
cx.reparent(&query_editor);
self.subscription = Some(cx.observe(&search, |_, _, cx| cx.notify()));
self.active_project_search = Some(search);
ToolbarItemLocation::PrimaryLeft {