From 7e20424b29f426b37315af07324be01671477b5d Mon Sep 17 00:00:00 2001 From: Guldoman Date: Wed, 18 Oct 2023 06:46:27 +0200 Subject: [PATCH] Ignore keypresses during IME composition (#1573) Some IMEs continue sending keypresses even during composition, so we just ignore them. --- data/core/init.lua | 3 +++ data/core/keymap.lua | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index 890d79c5..8b43d8ed 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -1278,6 +1278,9 @@ function core.on_event(type, ...) elseif type == "textediting" then ime.on_text_editing(...) elseif type == "keypressed" then + -- In some cases during IME composition input is still sent to us + -- so we just ignore it. + if ime.editing then return false end did_keymap = keymap.on_key_pressed(...) elseif type == "keyreleased" then keymap.on_key_released(...) diff --git a/data/core/keymap.lua b/data/core/keymap.lua index 3ab0c360..74e270d2 100644 --- a/data/core/keymap.lua +++ b/data/core/keymap.lua @@ -203,10 +203,6 @@ end -- Events listening -------------------------------------------------------------------------------- function keymap.on_key_pressed(k, ...) - -- In MacOS and Windows during IME composition input is still sent to us - -- so we just ignore it - if PLATFORM ~= "Linux" and ime.editing then return false end - local mk = modkey_map[k] if mk then keymap.modkeys[mk] = true