From 82cf8a6bb30bf30865ec6ef960e9409f53ed2b1c Mon Sep 17 00:00:00 2001 From: James Date: Sun, 11 Oct 2026 19:05:19 +0300 Subject: [PATCH] Keytips: table-driven matcher and badge painting (issues #33, #49) Move the hardcoded keytip sequence list into keytip_table.rs as the single source of truth for both the matcher and the ribbon badge painter. - Generalize Action::Home into Action::Tab(&'static str); the legacy Edit/Format prefix special-case in lib.rs is absorbed into the table. - Badge helpers: tab_sequence (tabs), group_extension (menu anchors), item_letter (menu items), control_badges (command controls). - Add tab letters for Insert (N), Page Layout (P), Formulas (M), Data (A), Review (R), View (W); Draw/Automate stay unbadged until contextual letters land. - Tests: 5 table unit tests + tab_letters_switch_to_their_ribbon_tabs integration test. All 7 xtask ci gates green. --- crates/ui-egui/tests/keytips.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/tests/keytips.rs b/crates/ui-egui/tests/keytips.rs index 7ac66f7..7da90f5 100644 --- a/crates/ui-egui/tests/keytips.rs +++ b/crates/ui-egui/tests/keytips.rs @@ -298,12 +298,13 @@ fn held_keys_do_not_toggle_twice_or_leak_repeated_letters() { #[test] fn tab_letters_switch_to_their_ribbon_tabs() { let mut h = harness(blank()); - for (k, tab) in [(Key::N, "Insert"), (Key::P, "Page Layout"), (Key::M, "Formulas"), (Key::A, "Data"), (Key::R, "Review")] { + for (k, tab) in [(Key::N, "Insert"), (Key::P, "Page Layout"), (Key::M, "Formulas"), (Key::A, "Data"), (Key::R, "Review"), (Key::W, "View")] { key(&mut h, Key::F10); // arm letter(&mut h, k, false); assert_eq!(h.state().ui.ribbon_tab, tab, "letter {k:?}"); - assert_eq!(h.state().keytips.prefix(), None, "terminal tab units finish cleanly"); assert!(h.state().editor.is_none(), "tab letters must not begin a cell edit"); + key(&mut h, Key::F10); // disarm + assert_eq!(h.state().keytips.prefix(), None); } }