diff options
author | nanahi <130121847+na-na-hi@users.noreply.github.com> | 2025-02-08 05:44:26 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2025-02-17 16:56:47 +0000 |
commit | 052870be9c81c039d6fd7e4654e94f04a85cd163 (patch) | |
tree | 9946bf035f15f152c103d31ba30640b001fff830 /player | |
parent | bebecdf0480d93e9c49f22b6d301e2516d0cee46 (diff) | |
download | mpv-052870be9c81c039d6fd7e4654e94f04a85cd163.tar.bz2 mpv-052870be9c81c039d6fd7e4654e94f04a85cd163.tar.xz |
console.lua: enable/disable IME on demand
This makes console and mp.input users enable IME when text input is
active and restore IME to the previous state when text input is inactive,
to ensure the best IME mode is selected based on input context.
Diffstat (limited to 'player')
-rw-r--r-- | player/lua/console.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/player/lua/console.lua b/player/lua/console.lua index 807d7e928b..f61be81a03 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -81,6 +81,7 @@ local repl_active = false local osd_msg_active = false local insert_mode = false local pending_update = false +local ime_active = mp.get_property_bool('input-ime') local line = '' local cursor = 1 local default_prompt = '>' @@ -1882,6 +1883,8 @@ set_active = function (active) insert_mode = false define_key_bindings() mp.set_property_bool('user-data/mpv/console/open', true) + ime_active = mp.get_property_bool('input-ime') + mp.set_property_bool('input-ime', true) if not input_caller then prompt = default_prompt @@ -1903,6 +1906,7 @@ set_active = function (active) undefine_key_bindings() mp.enable_messages('silent:terminal-default') mp.set_property_bool('user-data/mpv/console/open', false) + mp.set_property_bool('input-ime', ime_active) if input_caller then mp.commandv('script-message-to', input_caller, 'input-event', |