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.
This commit is contained in:
pagedown
2022-01-23 22:22:24 +08:00
parent 3ee12082f2
commit b2d0c35fc2

View File

@@ -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) {