From e202bae9d3736341dc2d0c832797aaf45e1ef0b0 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Sun, 9 Sep 2012 23:08:44 +0200 Subject: text: Add delete_surrounding_text to protocol Add delete_surrounding_text event in the text_model interface and the request in the input_method_context interface. Implement it in the example editor client and in the example keyboard so that the backspace key works with it. Signed-off-by: Jan Arne Petersen --- clients/keyboard.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clients/keyboard.c') diff --git a/clients/keyboard.c b/clients/keyboard.c index 4bc7d240..588ef785 100644 --- a/clients/keyboard.c +++ b/clients/keyboard.c @@ -222,6 +222,10 @@ keyboard_handle_key(struct keyboard *keyboard, const struct key *key) strlen(keyboard->keyboard->preedit_string)); break; case keytype_backspace: + if (strlen(keyboard->keyboard->preedit_string) == 0) { + input_method_context_delete_surrounding_text(keyboard->keyboard->context, + -1, 1); + } break; case keytype_enter: break; -- cgit v1.2.1