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:
parent
3b9f504d75
commit
af8f26dd34
1 changed files with 17 additions and 6 deletions
|
@ -944,10 +944,21 @@ fn about(
|
||||||
let message = format!("{release_channel} {version} {debug}");
|
let message = format!("{release_channel} {version} {debug}");
|
||||||
let detail = AppCommitSha::try_global(cx).map(|sha| sha.full());
|
let detail = AppCommitSha::try_global(cx).map(|sha| sha.full());
|
||||||
|
|
||||||
let prompt = window.prompt(PromptLevel::Info, &message, detail.as_deref(), &["OK"], cx);
|
let prompt = window.prompt(
|
||||||
cx.foreground_executor()
|
PromptLevel::Info,
|
||||||
.spawn(async {
|
&message,
|
||||||
prompt.await.ok();
|
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();
|
.detach();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue