[ibus] Send an empty TextEditing event when the text is cleared by pressing backspace.
authorAlex Baines <alex@abaines.me.uk>
Sun, 01 Feb 2015 21:08:54 +0000
changeset 9645b1e7169d1dcb
parent 9644 2bd2c601df72
child 9646 9d4917e2d909
[ibus] Send an empty TextEditing event when the text is cleared by pressing backspace.
src/core/linux/SDL_ibus.c
     1.1 --- a/src/core/linux/SDL_ibus.c	Tue May 26 20:55:03 2015 -0400
     1.2 +++ b/src/core/linux/SDL_ibus.c	Sun Feb 01 21:08:54 2015 +0000
     1.3 @@ -156,12 +156,12 @@
     1.4          dbus->message_iter_init(msg, &iter);
     1.5          text = IBus_GetVariantText(conn, &iter, dbus);
     1.6          
     1.7 -        if (text && *text) {
     1.8 +        if (text) {
     1.9              char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
    1.10              size_t text_bytes = SDL_strlen(text), i = 0;
    1.11              size_t cursor = 0;
    1.12              
    1.13 -            while (i < text_bytes) {
    1.14 +            do {
    1.15                  size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
    1.16                  size_t chars = IBus_utf8_strlen(buf);
    1.17                  
    1.18 @@ -169,7 +169,7 @@
    1.19  
    1.20                  i += sz;
    1.21                  cursor += chars;
    1.22 -            }
    1.23 +            } while (i < text_bytes);
    1.24          }
    1.25          
    1.26          SDL_IBus_UpdateTextRect(NULL);