diff options
| author | a-kenji <aks.kenji@protonmail.com> | 2021-03-11 16:38:22 +0100 |
|---|---|---|
| committer | a-kenji <aks.kenji@protonmail.com> | 2021-03-11 16:38:22 +0100 |
| commit | b4fca93eb71ad15c39a539d0d511b57785d177ad (patch) | |
| tree | 50df936370c8e21e42d2861e4137ed1a83c6334b /src/common | |
| parent | Poking around (diff) | |
| download | sl0ppij-b4fca93eb71ad15c39a539d0d511b57785d177ad.tar.gz sl0ppij-b4fca93eb71ad15c39a539d0d511b57785d177ad.tar.xz sl0ppij-b4fca93eb71ad15c39a539d0d511b57785d177ad.zip | |
Poking
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/input/keybinds.rs | 13 |
1 files 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 } |
