From b4fca93eb71ad15c39a539d0d511b57785d177ad Mon Sep 17 00:00:00 2001 From: a-kenji Date: Thu, 11 Mar 2021 16:38:22 +0100 Subject: [PATCH] Poking --- src/common/input/keybinds.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs index 2c395d37..de75c38f 100644 --- a/src/common/input/keybinds.rs +++ b/src/common/input/keybinds.rs @@ -54,18 +54,17 @@ impl Keybinds { /// Merges two Keybinds structs into one Keybinds struct /// `other` overrides the ModeKeybinds of `self`. fn merge_keybinds(&self, other: Keybinds) -> Keybinds { - let mut keybinds = Keybinds::default(); + let mut keybinds = Keybinds::new(); - for mode in InputMode::iter() { - let mut mode_keybinds: ModeKeybinds = if let Some(keybind) = self.0.get(&mode) { - keybind.clone() - } else { - ModeKeybinds::default() + for mode in self.0.keys().chain(other.0.keys()) { + let mut mode_keybinds = ModeKeybinds::new(); + if let Some(keybind) = self.0.get(&mode) { + mode_keybinds.0.extend(keybind.0.clone()); }; if let Some(keybind) = other.0.get(&mode) { mode_keybinds.0.extend(keybind.0.clone()); } - keybinds.0.insert(mode, mode_keybinds); + keybinds.0.insert(mode.clone(), mode_keybinds); } keybinds }