Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
markdown: Only change the copy code icon to a check temporarily (#26079)
Marshall Bowers67f9b2b87f44
diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rsindex e8313ea9128..b68dd892823 100644--- a/crates/markdown/src/markdown.rs+++ b/crates/markdown/src/markdown.rs@@ -6,6 +6,7 @@ use std::mem;use std::ops::Range;use std::rc::Rc;use std::sync::Arc;+use std::time::Duration;use gpui::{actions, point, quad, AnyElement, App, Bounds, ClipboardItem, CursorStyle, DispatchPhase,@@ -786,12 +787,28 @@ impl Element for MarkdownElement {).to_string();move |_event, _window, cx| {+ let id = id.clone();markdown.update(cx, |this, cx| {this.copied_code_blocks.insert(id.clone());cx.write_to_clipboard(ClipboardItem::new_string(code.clone(),));++ cx.spawn(|this, cx| async move {+ cx.background_executor()+ .timer(Duration::from_secs(2))+ .await;++ cx.update(|cx| {+ this.update(cx, |this, cx| {+ this.copied_code_blocks.remove(&id);+ cx.notify();+ })+ })+ .ok();+ })+ .detach();});}}),