Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Make buffer search bar capture CopyPath & CopyRelativePath actions (#38645)
Miaoa0514af58955
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex fbf70322b89..38ebdb4909b 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -19308,6 +19308,8 @@ impl Editor {&& let Some(path) = path.to_str(){cx.write_to_clipboard(ClipboardItem::new_string(path.to_string()));+ } else {+ cx.propagate();}}@@ -19321,6 +19323,8 @@ impl Editor {&& let Some(path) = path.to_str(){cx.write_to_clipboard(ClipboardItem::new_string(path.to_string()));+ } else {+ cx.propagate();}}diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rsindex dd096cde851..925d390cb3e 100644--- a/crates/search/src/buffer_search.rs+++ b/crates/search/src/buffer_search.rs@@ -28,7 +28,7 @@ use schemars::JsonSchema;use serde::Deserialize;use settings::Settings;use std::sync::Arc;-use zed_actions::outline::ToggleOutline;+use zed_actions::{outline::ToggleOutline, workspace::CopyPath, workspace::CopyRelativePath};use ui::{BASE_REM_SIZE_IN_PX, IconButton, IconButtonShape, IconName, Tooltip, h_flex, prelude::*,@@ -425,6 +425,16 @@ impl Render for BufferSearchBar {active_searchable_item.relay_action(Box::new(ToggleOutline), window, cx);}}))+ .on_action(cx.listener(|this, _: &CopyPath, window, cx| {+ if let Some(active_searchable_item) = &mut this.active_searchable_item {+ active_searchable_item.relay_action(Box::new(CopyPath), window, cx);+ }+ }))+ .on_action(cx.listener(|this, _: &CopyRelativePath, window, cx| {+ if let Some(active_searchable_item) = &mut this.active_searchable_item {+ active_searchable_item.relay_action(Box::new(CopyRelativePath), window, cx);+ }+ })).when(replacement, |this| {this.on_action(cx.listener(Self::toggle_replace)).when(in_replace, |this| {