From 42d9cf69789a6ee3110548d7862b6dfabc0b6e4e Mon Sep 17 00:00:00 2001 From: Alex Baines Date: Sun, 1 Feb 2015 21:08:54 +0000 Subject: [PATCH] [ibus] Send an empty TextEditing event when the text is cleared by pressing backspace. --- src/core/linux/SDL_ibus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index 8daa5d537e2fa..d3267ea8aefd7 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -156,12 +156,12 @@ IBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *user_data) dbus->message_iter_init(msg, &iter); text = IBus_GetVariantText(conn, &iter, dbus); - if (text && *text) { + if (text) { char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; size_t cursor = 0; - while (i < text_bytes) { + do { size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); size_t chars = IBus_utf8_strlen(buf); @@ -169,7 +169,7 @@ IBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *user_data) i += sz; cursor += chars; - } + } while (i < text_bytes); } SDL_IBus_UpdateTextRect(NULL);