Add a Copy button for About Zed (#33197)

Closes #33160

Since `TaskDialog` doesn’t allow users to copy its contents directly,
VSCode added a `Copy` button so users can easily copy the message.




https://github.com/user-attachments/assets/04090753-226f-44d9-992c-8cc8cb8d7ecb




Release Notes:

- N/A
This commit is contained in:
张小白 2025-06-22 19:12:12 +08:00 committed by GitHub
parent 3b9f504d75
commit af8f26dd34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -944,10 +944,21 @@ fn about(
let message = format!("{release_channel} {version} {debug}");
let detail = AppCommitSha::try_global(cx).map(|sha| sha.full());
let prompt = window.prompt(PromptLevel::Info, &message, detail.as_deref(), &["OK"], cx);
cx.foreground_executor()
.spawn(async {
prompt.await.ok();
let prompt = window.prompt(
PromptLevel::Info,
&message,
detail.as_deref(),
&["Copy", "OK"],
cx,
);
cx.spawn(async move |_, cx| {
if let Ok(0) = prompt.await {
let content = format!("{}\n{}", message, detail.as_deref().unwrap_or(""));
cx.update(|cx| {
cx.write_to_clipboard(gpui::ClipboardItem::new_string(content));
})
.ok();
}
})
.detach();
}