keyboard: Allow backspace for pre-edit text
authorJan Arne Petersen <jpetersen@openismus.com>
Mon, 17 Sep 2012 13:28:08 +0000 (15:28 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 25 Sep 2012 15:24:49 +0000 (11:24 -0400)
When there is a pre-edit text delete the last character of the pre-edit
text with the backspace key.

clients/keyboard.c

index bf0e9f0..8820a22 100644 (file)
@@ -233,6 +233,11 @@ keyboard_handle_key(struct keyboard *keyboard, const struct key *key)
                        if (strlen(keyboard->keyboard->preedit_string) == 0) {
                                input_method_context_delete_surrounding_text(keyboard->keyboard->context,
                                                                             -1, 1);
+                       } else {
+                               keyboard->keyboard->preedit_string[strlen(keyboard->keyboard->preedit_string) - 1] = '\0';
+                               input_method_context_preedit_string(keyboard->keyboard->context,
+                                                                   keyboard->keyboard->preedit_string,
+                                                                   strlen(keyboard->keyboard->preedit_string));
                        }
                        break;
                case keytype_enter: