From 53c84eb3a77a80fa74b05f518aada96b1db76680 Mon Sep 17 00:00:00 2001 From: Joseph <124534919+JShanklin@users.noreply.github.com> Date: Sun, 25 Oct 2026 18:10:09 +0000 Subject: [PATCH] Toolbar: a drop-down row's tooltip names its rebound key (#6290) The row itself showed the key the command runs from (#1810), but its help tooltip still named the default one. Co-authored-by: Claude Opus 5.5 --- crates/ui-egui/src/toolbar.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 475b2f0b7..61de64a4d 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -1818,7 +1818,7 @@ fn dropdown_row(app: &SolveApp, ui: &mut egui::Ui, c: &'static solidcraft_engine } // A disabled row says why; a documented command also shows its help (#2758). let reason = info.disabled_reason.as_deref().filter(|_| !info.enabled); - let resp = match crate::command_help::row_tip(c.id, &label, c.shortcut, reason) { + let resp = match crate::command_help::row_tip(c.id, &label, Some(shortcut.as_str()).filter(|k| !k.is_empty()), reason) { Some(tip) => crate::command_help::tooltip(resp, c.id, tip), None => resp, }; @@ -2959,6 +2959,21 @@ mod dropdown_toggle_tests { h.frames(2); assert!(rect_of("toolbar_dropdown").is_none(), "the second click closes it"); } + + /// A drop-down row's help tooltip names the key the command runs from now, not its default. + #[test] + fn a_drop_down_row_tooltip_names_a_rebound_key() { + let mut h = Harness::new(); + h.app.home.open = false; + h.frames(3); + crate::keymap::bind(&mut h.app, "solid.shell", "Shift+J", false).unwrap(); + h.step(&json!({"click": {"handle": "panel:MODEL:MODIFY"}})).unwrap(); + h.frames(2); + h.step(&json!({"move": {"handle": "dropdown:solid.shell"}})).unwrap(); + h.frames(40); + let shell = h.app.tr_label("Shell").to_string(); + assert!(h.widget(&format!("{shell} (Shift+J)")).is_some(), "the tooltip shows the new key"); + } } #[cfg(test)]