浏览代码

cocoa: Reset IME when sending composed text

This will send an empty `TEXTEDITING` event that is used to signal the 
end of the composition.
Guldoman 2 年之前
父节点
当前提交
084fa4c3fa
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/video/cocoa/SDL_cocoakeyboard.m

+ 6 - 1
src/video/cocoa/SDL_cocoakeyboard.m

@@ -66,6 +66,11 @@
         str = [aString UTF8String];
         str = [aString UTF8String];
     }
     }
 
 
+    /* We're likely sending the composed text, so we reset the IME status. */
+    if ([self hasMarkedText]) {
+        [self unmarkText];
+    }
+
     SDL_SendKeyboardText(str);
     SDL_SendKeyboardText(str);
 }
 }
 
 
@@ -114,7 +119,7 @@
                         (int) selectedRange.location, (int) selectedRange.length);
                         (int) selectedRange.location, (int) selectedRange.length);
 
 
     DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText,
     DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText,
-          selRange.location, selRange.length);
+          selectedRange.location, selectedRange.length);
 }
 }
 
 
 - (void)unmarkText
 - (void)unmarkText