On macOS, fix assertion when pressing Fn key

This commit is contained in:
Kirill Chibisov 2023-11-17 15:56:03 +04:00 committed by GitHub
parent 14140607d1
commit 7bed5eecfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 95 additions and 91 deletions

View file

@ -156,13 +156,11 @@ pub(crate) fn create_key_event(
// Also not checking if this is a release event because then this issue would
// still affect the key release.
Some(text) if !has_ctrl => Key::Character(text.clone()),
_ => {
let modifierless_chars = match key_without_modifiers.as_ref() {
Key::Character(ch) => ch,
_ => "",
};
get_logical_key_char(ns_event, modifierless_chars)
}
_ => match key_without_modifiers.as_ref() {
Key::Character(ch) => get_logical_key_char(ns_event, ch),
// Don't try to get text for events which likely don't have it.
_ => key_without_modifiers.clone(),
},
};
(logical_key, key_without_modifiers)