Test if text is being inserted rather than if text is present

This commit is contained in:
Kovid Goyal 2022-01-20 10:46:50 +05:30
parent 76e7e7d61f
commit 1f4372b34c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1423,7 +1423,7 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
char *s = _glfw.ns.text + strnlen(_glfw.ns.text, sizeof(_glfw.ns.text)); char *s = _glfw.ns.text + strnlen(_glfw.ns.text, sizeof(_glfw.ns.text));
snprintf(s, sizeof(_glfw.ns.text) - (s - _glfw.ns.text), "%s", utf8); snprintf(s, sizeof(_glfw.ns.text) - (s - _glfw.ns.text), "%s", utf8);
_glfw.ns.text[sizeof(_glfw.ns.text) - 1] = 0; _glfw.ns.text[sizeof(_glfw.ns.text) - 1] = 0;
if (!in_key_down && !_glfw.ns.text[0]) { if (!in_key_down && !strlen(utf8)) {
// is called by cocoa when a modifier is pressed, for example shift // is called by cocoa when a modifier is pressed, for example shift
GLFWkeyevent dummy = {.action = GLFW_RELEASE, .ime_state = GLFW_IME_PREEDIT_CHANGED}; GLFWkeyevent dummy = {.action = GLFW_RELEASE, .ime_state = GLFW_IME_PREEDIT_CHANGED};
_glfwInputKeyboard(window, &dummy); _glfwInputKeyboard(window, &dummy);