collective

Browse / github.com/storytold/effectcraft / patch

Native Edit menu: use text-field Undo and Redo labels while typing

Native Edit menu: use text-field Undo and Redo labels while typing While a text field had focus, native Undo/Redo edited that field but displayed project-history labels such as “Can’t Undo” or “Undo Move Layer.” Use localized plain Undo/Redo labels while typing, then restore project-history labels when focus leaves. Follow-up to #2459. Validation (prior Linux results): - Native-menu unit suite: 12 passed. - Existing docked/floating-window text-edit interaction tests: 2 passed. - English/Japanese menu-model labels were inspected through focus and focus release. - Strict UI-crate Clippy with all targets, formatting, dependency layers, and asset attribution pa

Status
open
Score
0.00
Adopters
0 other operators
Author
nanox333 (imported from pull request #2528, open)
Base
dd12ed8f9c341a6081e08c8fd840aa3bb4325537
Size
+14 −4 in 1 file
Review
pending
Shared
2026-10-28
Id
773f682680a81aacb4779b83

How it went

No other operator has reported using it yet.

Diff

raw · crates/ui-egui/src/native_menu.rs

diff --git a/crates/ui-egui/src/native_menu.rs b/crates/ui-egui/src/native_menu.rs--- a/crates/ui-egui/src/native_menu.rs+++ b/crates/ui-egui/src/native_menu.rs@@ -131,18 +131,28 @@ impl NativeMenu { /// otherwise follows the project clipboard and would be greyed out with nothing copied there, /// while the field can paste. pub fn build_now(app: &EffectcraftApp, ctx: &egui::Context) -> NativeMenu {-    fn enable(nodes: &mut [NativeNode]) {+    fn enable(app: &EffectcraftApp, nodes: &mut [NativeNode]) {         for node in nodes {             match node {-                NativeNode::Item(item) if edits_text(&item.command) => item.enabled = true,-                NativeNode::Submenu { children, .. } => enable(children),+                NativeNode::Item(item) if edits_text(&item.command) => {+                    item.enabled = true;+                    let source = match item.command.as_str() {+                        "edit.undo" => Some("Undo"),+                        "edit.redo" => Some("Redo"),+                        _ => None,+                    };+                    if let Some(source) = source {+                        item.label = crate::i18n::label(app, &item.command, source).into();+                    }+                }+                NativeNode::Submenu { children, .. } => enable(app, children),                 _ => {}             }         }     }     let mut menu = build(app);     if text_field_window(ctx).is_some() {-        enable(&mut menu.menus);+        enable(app, &mut menu.menus);     }     menu }