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 <noreply@anthropic.com>
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user