Ignore keypresses during IME composition (#1573)

Some IMEs continue sending keypresses even during composition, so we 
just ignore them.
This commit is contained in:
Guldoman 2023-10-18 06:46:27 +02:00 committed by takase1121
parent a066190ee2
commit 8c451928bf
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
2 changed files with 3 additions and 4 deletions

View File

@ -1243,6 +1243,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(...)

View File

@ -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