From b280d79f7610a744a1f0ac1ca49633060136b4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Thu, 29 Aug 2024 12:43:03 +0800 Subject: [PATCH] fix: keybindings disappear when mixing presets with a wrong filter condition (#1568) --- yazi-config/src/keymap/keymap.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yazi-config/src/keymap/keymap.rs b/yazi-config/src/keymap/keymap.rs index cfdb43ca1..c01851c8e 100644 --- a/yazi-config/src/keymap/keymap.rs +++ b/yazi-config/src/keymap/keymap.rs @@ -67,10 +67,10 @@ impl<'de> Deserialize<'de> for Keymap { fn mix(mut a: IndexSet, b: IndexSet, c: IndexSet) -> Vec { let mut seen = HashSet::new(); - b.iter().filter_map(|v| v.on.get(1)).for_each(|&k| _ = seen.insert(k)); - c.iter().filter_map(|v| v.on.get(1)).for_each(|&k| _ = seen.insert(k)); + b.iter().filter(|&v| v.on.len() > 1).for_each(|v| _ = seen.insert(&v.on[..2])); + c.iter().filter(|&v| v.on.len() > 1).for_each(|v| _ = seen.insert(&v.on[..2])); - a.retain(|v| v.on.len() < 2 || !seen.contains(&v.on[1])); + a.retain(|v| v.on.len() < 2 || !seen.contains(&v.on[..2])); Preset::mix(a, b, c).collect() }