R4.10 round 1 fixes: background copies, menu offer served once

Copy as Rich Text, HTML Code and Plain Text convert off the window
thread; a newer copy cancels an older one. Offer hands its request to
the menu host once, so a dismissed menu stays shut when its tab returns.
ElyMark Delete Image now targets the pressed picture (component a4bf696).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-14 21:17:10 -04:00
1 parent 5462b8fb0e
commit 67fa5bfc94
7 files changed
+111 -45

No files matched your search

+7 -4
View File
@@ -1,6 +1,6 @@
//! Ely's right-click menus, gated by the kernel's (DOC-02).
use std::io;
use std::{cell::Cell, io};
use ely_gpui_component::{
menus::{ContextMenu, Menu, MenuItem},
@@ -15,18 +15,21 @@ pub struct Offer<W> {
pub what: W,
/// Bumps for each menu, so each opens once.
request: (u64, Point<Pixels>),
/// Handed to a host; a remounted host must not reopen.
served: Cell<bool>,
}
impl<W> Offer<W> {
/// The next menu after `last`.
pub fn new(last: Option<&Offer<W>>, tab: u64, what: W, at: Point<Pixels>) -> Self {
let number = last.map_or(1, |last| last.request.0 + 1);
Offer { tab, what, request: (number, at) }
Offer { tab, what, request: (number, at), served: Cell::new(false) }
}
/// Its host, opened at the point.
/// Its host; only the first render opens it.
pub fn host(&self, id: &'static str, menu: Menu) -> ContextMenu {
ContextMenu::new(id, menu).manual(Some(self.request))
let request = (!self.served.replace(true)).then_some(self.request);
ContextMenu::new(id, menu).manual(request)
}
}