From bc1009babc04eb3dbe30c452756173fb9fed0ee5 Mon Sep 17 00:00:00 2001 From: smolck <46855713+smolck@users.noreply.github.com> Date: Sun, 27 Jun 2021 16:32:05 -0500 Subject: [PATCH] make dead keys work w/out breaking ctrl mappings (#767) --- src/window/window_wrapper/keyboard_manager.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/window/window_wrapper/keyboard_manager.rs b/src/window/window_wrapper/keyboard_manager.rs index 66d5c83..69897a3 100644 --- a/src/window/window_wrapper/keyboard_manager.rs +++ b/src/window/window_wrapper/keyboard_manager.rs @@ -18,7 +18,6 @@ fn use_logo(_: bool) -> bool { false } - #[cfg(not(target_os = "macos"))] fn use_alt(alt: bool) -> bool { alt @@ -166,11 +165,14 @@ impl KeyboardManager { .send(UiCommand::Keyboard(keybinding_string)) .expect("Could not send keyboard ui command"); } else { - let key_text = if self.alt && cfg!(target_os = "macos") { - key_event.text_with_all_modifiers() - } else { - key_event.text - }; + let is_dead_key = key_event.text_with_all_modifiers().is_some() + && key_event.text.is_none(); + let key_text = + if (self.alt || is_dead_key) && cfg!(target_os = "macos") { + key_event.text_with_all_modifiers() + } else { + key_event.text + }; if let Some(key_text) = key_text { // This is not a control key, so we rely upon winit to determine if