From 3b15b46d08ea74f539bdd944854f8a7e00a56dda Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 22 Jan 2022 16:13:44 +0530 Subject: [PATCH] Also deal with setMarkedText called from event loop with actual marked text --- glfw/cocoa_window.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index fe2f3f3eb..4c83b65a2 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1397,6 +1397,12 @@ is_ascii_control_char(char x) { [markedText release]; markedText = [[NSMutableAttributedString alloc] initWithString:string]; } + if (!in_key_handler) { + debug_key("updating IME text in kitty from setMarkedText called from event loop: %s\n", _glfw.ns.text); + GLFWkeyevent glfw_keyevent = {.text=_glfw.ns.text, .ime_state = GLFW_IME_PREEDIT_CHANGED}; + _glfwInputKeyboard(window, &glfw_keyevent); + _glfw.ns.text[0] = 0; + } } - (void)unmarkText