From a060bf72232af4f97d5411337a7aaef098d2b491 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 12 Nov 2021 08:52:32 +0530 Subject: [PATCH] Also unmark text on pressing esc As with backspace, without this the preedit text is not cleared when the IME is canceled by esc --- 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 0420fa8a8..ef604eb60 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1235,7 +1235,7 @@ is_ascii_control_char(char x) { const uint32_t key = translateKey(keycode, true); const bool process_text = !window->ns.textInputFilterCallback || window->ns.textInputFilterCallback(key, mods, keycode, flags) != 1; _glfw.ns.text[0] = 0; - if (keycode == 0x33 /* backspace */) [self unmarkText]; + if (keycode == 0x33 /* backspace */ || keycode == 0x35 /* escape */) [self unmarkText]; GLFWkeyevent glfw_keyevent = {.key = key, .native_key = keycode, .action = GLFW_PRESS, .mods = mods}; if (!_glfw.ns.unicodeData) { // Using the cocoa API for key handling is disabled, as there is no