Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

repl: Show feedback when copying REPL output (#64276)

Jason Fengb7be0f185be6
diff --git a/crates/repl/src/outputs.rs b/crates/repl/src/outputs.rs
index b4fb634d693..54c058bb32f 100644
--- a/crates/repl/src/outputs.rs
+++ b/crates/repl/src/outputs.rs
@@ -196,15 +196,13 @@ impl Output {
.pl_1()
.when(v.has_clipboard_content(window, cx), |el| {
let v = v.clone();
- el.child(
- IconButton::new(ElementId::Name("copy-output".into()), IconName::Copy)
- .style(ButtonStyle::Transparent)
- .tooltip(Tooltip::text("Copy Output"))
- .on_click(move |_, window, cx| {
- let clipboard_content = v.clipboard_content(window, cx);
- if let Some(clipboard_content) = clipboard_content.as_ref() {
- cx.write_to_clipboard(clipboard_content.clone());
+ el.child(
+ CopyButton::new(("copy-output", v.entity_id()), "")
+ .tooltip_label("Copy Output")
+ .custom_on_click(move |window, cx| {
+ if let Some(clipboard_item) = v.clipboard_content(window, cx) {
+ cx.write_to_clipboard(clipboard_item);
}
}),
)