Fix sending platform-specific shortcut keys to frontend before editor is initialized with the platform set

This commit is contained in:
Keavon Chambers
2025-12-04 15:35:30 -08:00
parent 783ea0b437
commit 2ee8e56cef
12 changed files with 77 additions and 52 deletions
@@ -136,16 +136,11 @@ pub enum ActionShortcut {
impl ActionShortcut {
pub fn realize_shortcut(&mut self, action_input_mapping: &impl Fn(&MessageDiscriminant) -> Option<KeysGroup>) {
match self {
Self::Action(action) => {
if let Some(keys) = action_input_mapping(action) {
*self = Self::Shortcut(keys.into());
} else {
*self = Self::Shortcut(KeysGroup::default().into());
}
}
Self::Shortcut(shortcut) => {
warn!("Calling `.to_keys()` on a `ActionShortcut::Shortcut` is a mistake/bug. Shortcut is: {shortcut:?}.");
if let Self::Action(action) = self {
if let Some(keys) = action_input_mapping(action) {
*self = Self::Shortcut(keys.into());
} else {
*self = Self::Shortcut(KeysGroup::default().into());
}
}
}