noop identical keys
All checks were successful
moparisthebest/rusty-keys/pipeline/head This commit looks good

This commit is contained in:
Travis Burtrum 2021-09-25 01:50:24 -04:00
parent d0e38d0e55
commit 527ab97a04

View File

@ -149,8 +149,14 @@ impl<K, T, E, R> KeyMaps<K, T, E, R>
let mut keymap = KeyMap::new();
let mut i: usize = 0;
for key_code in v {
// todo: if these are the same, do Noop instead
// if it's a direct key and it's the same, don't do any mapping
if let Key::Direct(key) = key_code {
if base_keymap[i] != key {
keymap.map(base_keymap[i], key_code);
}
} else {
keymap.map(base_keymap[i], key_code);
}
i = i + 1;
if i > base_keymap.len() {
panic!("all keymaps must be the same length, keymap index 0 length: {}, index {} length: {},", base_keymap.len(), x, i);