Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Inline buttons
Marshall Bowers2ac472e0e068
diff --git a/crates/search2/src/buffer_search.rs b/crates/search2/src/buffer_search.rsindex dcf9c4c6f22..ec70b372199 100644--- a/crates/search2/src/buffer_search.rs+++ b/crates/search2/src/buffer_search.rs@@ -289,18 +289,26 @@ impl Render for BufferSearchBar {.child(self.render_text_input(&self.replacement_editor, cx)),).when(should_show_replace_input, |this| {- this.child(super::render_replace_button(- ReplaceNext,- ui::Icon::ReplaceNext,- "Replace next",- cx.listener(|this, _, cx| this.replace_next(&ReplaceNext, cx)),- ))- .child(super::render_replace_button(- ReplaceAll,- ui::Icon::ReplaceAll,- "Replace all",- cx.listener(|this, _, cx| this.replace_all(&ReplaceAll, cx)),- ))+ this.child(+ IconButton::new("search-replace-next", ui::Icon::ReplaceNext)+ .tooltip(move |cx| {+ Tooltip::for_action("Replace next", &ReplaceNext, cx)+ })+ .on_click(cx.listener(|this, _, cx| {+ this.replace_next(&ReplaceNext, cx)+ })),+ )+ .child(+ IconButton::new("search-replace-all", ui::Icon::ReplaceAll)+ .tooltip(move |cx| {+ Tooltip::for_action("Replace all", &ReplaceAll, cx)+ })+ .on_click(+ cx.listener(|this, _, cx| {+ this.replace_all(&ReplaceAll, cx)+ }),+ ),+ )})}),)diff --git a/crates/search2/src/search.rs b/crates/search2/src/search.rsindex 18fcc258f44..1d496a10b03 100644--- a/crates/search2/src/search.rs+++ b/crates/search2/src/search.rs@@ -5,10 +5,6 @@ pub use mode::SearchMode;use project::search::SearchQuery;use ui::{prelude::*, Tooltip};use ui::{ButtonStyle, Icon, IconButton};-//pub use project_search::{ProjectSearchBar, ProjectSearchView};-// use theme::components::{-// action_button::Button, svg::Svg, ComponentExt, IconButtonStyle, ToggleIconButtonStyle,-// };pub mod buffer_search;mod history;@@ -121,18 +117,3 @@ fn toggle_replace_button(.when(active, |button| button.style(ButtonStyle::Filled)).tooltip(|cx| Tooltip::for_action("Toggle replace", &ToggleReplace, cx))}--fn render_replace_button(- action: impl Action + 'static + Send + Sync,- icon: Icon,- tooltip: &'static str,- on_click: impl Fn(&gpui::ClickEvent, &mut WindowContext) + 'static,-) -> impl IntoElement {- let id: SharedString = format!("search-replace-{}", action.name()).into();- IconButton::new(id, icon)- .tooltip({- let action = action.boxed_clone();- move |cx| Tooltip::for_action(tooltip, &*action, cx)- })- .on_click(on_click)-}