From f225bfd0a704d0f27997cae859dd4094fd6d822b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 27 Nov 2026 15:50:59 -0800 Subject: [PATCH] Artboards: the Control bar's Name field renames on Enter or Tab and Escape cancels The Name field read the text field's latest edit event, so each keystroke renamed the artboard and Escape renamed it back, each as its own undo step. It now reads only the committed value: typing changes the draft, Escape restores the shown name without touching the document, and Enter or Tab renames the artboard in one undo step. --- crates/ui-egui/src/panels/artboards.rs | 2 +- crates/ui-egui/src/panels/artboards/tests.rs | 52 ++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/artboards.rs b/crates/ui-egui/src/panels/artboards.rs index 00c28f0297..270fc9edcf 100644 --- a/crates/ui-egui/src/panels/artboards.rs +++ b/crates/ui-egui/src/panels/artboards.rs @@ -70,7 +70,7 @@ fn icon_button(ui: &mut Ui, icon: &'static str, label: &'static str, enabled: bo fn name_field(ui: &mut Ui, name: &str) -> Option { let mut typed = None; Field::new(tl!("Name:")).id_salt("ab-name").show(ui, |ui, _| { - typed = TextField::new(tl!("Name:"), Bind::given(name.to_owned())).show(ui).events.landed().cloned(); + typed = TextField::new(tl!("Name:"), Bind::given(name.to_owned())).show(ui).events.committed().cloned(); }); typed.map(|n| n.trim().to_owned()).filter(|n| !n.is_empty() && n != name) } diff --git a/crates/ui-egui/src/panels/artboards/tests.rs b/crates/ui-egui/src/panels/artboards/tests.rs index beaf1466e4..1d0291dc4a 100644 --- a/crates/ui-egui/src/panels/artboards/tests.rs +++ b/crates/ui-egui/src/panels/artboards/tests.rs @@ -529,6 +529,58 @@ fn boards(app: &VectorcraftApp) -> (Vec, usize, Vec