From 86b2c3b579d227f2a9d8f089c7a07e02b207d74f Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Wed, 27 Apr 2022 17:10:57 +0900 Subject: [PATCH] macOS: Enable to clear preedit after commit input. --- src/cocoa_window.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index eea8c032..b37bd3c7 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -751,6 +751,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (void)unmarkText { [[markedText mutableString] setString:@""]; + window->nblocks = 0; + window->ntext = 0; + _glfwInputPreedit(window, 0); } - (NSArray*)validAttributesForMarkedText @@ -816,6 +819,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; _glfwInputChar(window, codepoint, mods, plain); } } + + [self unmarkText]; } - (void)doCommandBySelector:(SEL)selector @@ -2008,7 +2013,7 @@ VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance, void _glfwPlatformResetPreeditText(_GLFWwindow* window) { - NSTextInputContext *context = [NSTextInputContext currentInputContext]; + NSTextInputContext* context = [NSTextInputContext currentInputContext]; [context discardMarkedText]; [window->ns.view unmarkText]; }