Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
terminal/search: Partially fix search in terminal. There are two issues with search in terminal as is: - terminal's pane is not registered as a "legit" pane, so we dispatch buffer search bar::Deploy on the most recent "legit" pane. By legit I mean that workspace::active_pane will *never* return terminal pane as active. - We've had the implementation of as_searchable commented out. Duh!
Piotr Osiewiczb3d8b2313901
diff --git a/Cargo.lock b/Cargo.lockindex 13d4be62337..43717420560 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -7762,6 +7762,7 @@ dependencies = ["procinfo","project","rand 0.8.5",+ "search","serde","serde_derive","settings",diff --git a/crates/terminal_view/Cargo.toml b/crates/terminal_view/Cargo.tomlindex 110199a8d4b..d8484601834 100644--- a/crates/terminal_view/Cargo.toml+++ b/crates/terminal_view/Cargo.toml@@ -13,7 +13,7 @@ editor = { path = "../editor" }language = { path = "../language" }gpui = { path = "../gpui" }project = { path = "../project" }-# search = { path = "../search" }+search = { path = "../search" }settings = { path = "../settings" }theme = { path = "../theme" }util = { path = "../util" }diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rsindex 526cdf391ae..f5179d39a97 100644--- a/crates/terminal_view/src/terminal_panel.rs+++ b/crates/terminal_view/src/terminal_panel.rs@@ -101,9 +101,9 @@ impl TerminalPanel {}).into_any_element()});- // let buffer_search_bar = cx.build_view(search::BufferSearchBar::new);- // pane.toolbar()- // .update(cx, |toolbar, cx| toolbar.add_item(buffer_search_bar, cx));+ let buffer_search_bar = cx.add_view(search::BufferSearchBar::new);+ pane.toolbar()+ .update(cx, |toolbar, cx| toolbar.add_item(buffer_search_bar, cx));pane});let subscriptions = vec![diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rsindex d4dea29b49e..521efef7906 100644--- a/crates/terminal_view/src/terminal_view.rs+++ b/crates/terminal_view/src/terminal_view.rs@@ -28,7 +28,7 @@ use workspace::{item::{BreadcrumbText, Item, ItemEvent},notifications::NotifyResultExt,register_deserializable_item,- searchable::{SearchEvent, SearchOptions, SearchableItem},+ searchable::{SearchEvent, SearchOptions, SearchableItem, SearchableItemHandle},CloseActiveItem, NewCenterTerminal, Pane, ToolbarItemLocation, Workspace, WorkspaceId,};@@ -714,10 +714,9 @@ impl Item for TerminalView {false}- // todo!(search)- // fn as_searchable(&self, handle: &View<Self>) -> Option<Box<dyn SearchableItemHandle>> {- // Some(Box::new(handle.clone()))- // }+ fn as_searchable(&self, handle: &View<Self>) -> Option<Box<dyn SearchableItemHandle>> {+ Some(Box::new(handle.clone()))+ }fn breadcrumb_location(&self) -> ToolbarItemLocation {ToolbarItemLocation::PrimaryLeft