gui, fix some key codes

This commit is contained in:
Alexander Mohr 2025-05-25 22:06:41 +02:00
parent fcfd5c932d
commit ceecc490a6
3 changed files with 14 additions and 14 deletions

0
IO Normal file
View file

View file

@ -833,7 +833,6 @@ pub fn fork_if_configured(config: &Config) {
}
}
#[cfg(test)]
mod tests {
use super::*;
@ -847,7 +846,4 @@ mod tests {
let config: Config = toml::from_str(toml_str).expect("Failed to parse TOML");
assert_eq!(config.key_detection_type(), KeyDetectionType::Code);
}
}

View file

@ -371,16 +371,16 @@ impl From<u32> for Key {
52 => Key::Z,
// Numbers
10 => Key::Num0,
11 => Key::Num1,
12 => Key::Num2,
13 => Key::Num3,
14 => Key::Num4,
15 => Key::Num5,
16 => Key::Num6,
17 => Key::Num7,
18 => Key::Num8,
19 => Key::Num9,
10 => Key::Num1,
11 => Key::Num2,
12 => Key::Num3,
13 => Key::Num4,
14 => Key::Num5,
15 => Key::Num6,
16 => Key::Num7,
17 => Key::Num8,
18 => Key::Num9,
19 => Key::Num0,
// Function Keys
67 => Key::F1,
@ -987,6 +987,8 @@ fn handle_key_press<T: Clone + 'static + Send>(
update_view(query);
};
log::debug!("received key. code: {key_code}, key: {keyboard_key:?}");
if let Some(custom_keys) = custom_keys {
let mods = modifiers_from_mask(modifier_type);
for custom_key in &custom_keys.bindings {
@ -996,6 +998,8 @@ fn handle_key_press<T: Clone + 'static + Send>(
custom_key.key == keyboard_key.to_upper().into()
} && mods.is_subset(&custom_key.modifiers);
log::debug!("customy key {custom_key:?}, match {custom_key_match}");
if custom_key_match {
let search_lock = ui.search_text.lock().unwrap();
if let Err(e) = handle_selected_item(