fix(ui): show macOS group shortcuts in command palette

This commit is contained in:
AnhNgoo
2026-10-31 15:14:23 +07:00
parent 2d5be2c57a
commit 513f19ded3
2 changed files with 7 additions and 0 deletions
@@ -38,6 +38,9 @@ pub(super) fn command_search(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dial
(false, "edit.pasteSpecial", Some(_)) => Some("Ctrl+Alt+V".to_owned()),
// These metadata shortcuts are only bound on macOS.
(false, "home.alignLeft" | "home.alignCenter", Some(_)) => None,
// macOS uses Command+Shift+K/J, unlike the engine's Windows metadata.
(true, "data.group", Some(_)) => Some("Cmd+Shift+K".to_owned()),
(true, "data.ungroup", Some(_)) => Some("Cmd+Shift+J".to_owned()),
(_, _, keys) => keys.map(str::to_string),
},
)
+4
View File
@@ -104,6 +104,8 @@ fn command_search_shows_engine_shortcuts() {
("home.alignCenter", if os == OperatingSystem::Mac { "Center (Cmd+E)" } else { "Center Home" }),
("selection.row", "Select Entire Row (Shift+Space)"),
("selection.column", "Select Entire Column (Ctrl+Space)"),
("data.group", if os == OperatingSystem::Mac { "Group (Cmd+Shift+K)" } else { "Group (Alt+Shift+Right)" }),
("data.ungroup", if os == OperatingSystem::Mac { "Ungroup (Cmd+Shift+J)" } else { "Ungroup (Alt+Shift+Left)" }),
] {
h.state_mut().dialog.as_mut().unwrap().search = query.into();
h.run_steps(3);
@@ -152,6 +154,8 @@ fn command_palette_shortcuts_come_from_engine_metadata() {
("selection.currentRegion", "Ctrl+Shift+8"),
("home.alignLeft", "Cmd+L"),
("home.alignCenter", "Cmd+E"),
("data.group", "Alt+Shift+Right"),
("data.ungroup", "Alt+Shift+Left"),
] {
let command = commands.iter().find(|c| c.id == id).unwrap();
assert_eq!(command.shortcut, Some(expected), "{id}");