From b2d0c35fc2ad091d79461157a46a1ff963b9574b Mon Sep 17 00:00:00 2001 From: pagedown Date: Sun, 23 Jan 2022 22:22:24 +0800 Subject: [PATCH] Clear the pre-edit text only when inserting non-control characters Maintains the pre-edit input state after pressing the modifier key combination or function key while using the IME. --- glfw/cocoa_window.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 5ec9434c1..a2f79e809 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1461,7 +1461,7 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) { { const char *utf8 = polymorphic_string_as_utf8(string); debug_key("\n\tinsertText: %s replacementRange: (%lu, %lu)\n", utf8, replacementRange.location, replacementRange.length); - if ([self hasMarkedText]) { + if ([self hasMarkedText] && !is_ascii_control_char(utf8[0])) { [self unmarkText]; marked_text_cleared_by_insert = true; if (!in_key_handler) {