macOS: Enable to clear preedit after commit input.

This commit is contained in:
Daijiro Fukuda 2022-04-27 17:10:57 +09:00
parent c2923ac577
commit 86b2c3b579

View File

@ -751,6 +751,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)unmarkText - (void)unmarkText
{ {
[[markedText mutableString] setString:@""]; [[markedText mutableString] setString:@""];
window->nblocks = 0;
window->ntext = 0;
_glfwInputPreedit(window, 0);
} }
- (NSArray*)validAttributesForMarkedText - (NSArray*)validAttributesForMarkedText
@ -816,6 +819,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputChar(window, codepoint, mods, plain); _glfwInputChar(window, codepoint, mods, plain);
} }
} }
[self unmarkText];
} }
- (void)doCommandBySelector:(SEL)selector - (void)doCommandBySelector:(SEL)selector
@ -2008,7 +2013,7 @@ VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance,
void _glfwPlatformResetPreeditText(_GLFWwindow* window) void _glfwPlatformResetPreeditText(_GLFWwindow* window)
{ {
NSTextInputContext *context = [NSTextInputContext currentInputContext]; NSTextInputContext* context = [NSTextInputContext currentInputContext];
[context discardMarkedText]; [context discardMarkedText];
[window->ns.view unmarkText]; [window->ns.view unmarkText];
} }