R5.2: ElyDoc's right-click menu follows Word by target, items enabled as the kernel's menu allows; two rounds, R2 PASS

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 08:52:54 -04:00
1 parent e3c515b2f4
commit 9d80ba6f39
22 files changed
+764 -146

No files matched your search

+14 -3
View File
@@ -313,6 +313,7 @@ impl LokView {
return;
};
window.focus(&self.focus, cx);
self.right_at = (event.button == MouseButton::Right).then_some(event.position);
if event.button == MouseButton::Left && self.grab(event.position) {
cx.notify();
return;
@@ -391,7 +392,17 @@ impl LokView {
}
pub(super) fn on_copy(&mut self, _: &Copy, _: &mut Window, _: &mut Context<Self>) {
self.send(Input::Copy { cut: false });
self.copy(false);
}
/// Copies the selection out, or cuts it.
pub fn copy(&mut self, cut: bool) {
self.send(Input::Copy { cut });
}
/// Pastes the system clipboard.
pub fn paste(&mut self) {
self.send(Input::Paste);
}
pub(super) fn on_next_field(&mut self, _: &NextField, _: &mut Window, _: &mut Context<Self>) {
@@ -410,11 +421,11 @@ impl LokView {
}
pub(super) fn on_cut(&mut self, _: &Cut, _: &mut Window, _: &mut Context<Self>) {
self.send(Input::Copy { cut: true });
self.copy(true);
}
pub(super) fn on_paste(&mut self, _: &Paste, _: &mut Window, _: &mut Context<Self>) {
self.send(Input::Paste);
self.paste();
}
/// Pastes values or formulas alone (TABLE-08).
+5 -4
View File
@@ -1,6 +1,6 @@
//! What the view knows, for apps to read.
use gpui::FocusHandle;
use gpui::{FocusHandle, Pixels, Point};
use super::LokView;
use crate::Rect;
@@ -91,9 +91,10 @@ impl LokView {
&self.fonts
}
/// Takes the context menu the kernel last offered.
pub fn take_menu(&mut self) -> Option<String> {
self.menu.take()
/// Takes the kernel's last menu and the click that asked.
pub fn take_menu(&mut self) -> Option<(String, Option<Point<Pixels>>)> {
let menu = self.menu.take()?;
Some((menu, self.right_at.take()))
}
/// The paragraph's own tab stops, in 1/100 mm.