From 3fb6e718147d89f459574c16ff803c2caa7bf1b1 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 16 Jan 2013 21:26:52 +0100 Subject: [PATCH] editor: Add support for backspace keysym events Signed-off-by: Jan Arne Petersen --- clients/editor.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/clients/editor.c b/clients/editor.c index 462c4003..2909109d 100644 --- a/clients/editor.c +++ b/clients/editor.c @@ -304,6 +304,24 @@ text_model_keysym(void *data, return; } + if (key == XKB_KEY_BackSpace) { + const char *start, *end; + + text_entry_commit_and_reset(entry); + + start = utf8_prev_char(entry->text, entry->text + entry->cursor); + + if (start == NULL) + return; + + end = utf8_end_char(entry->text + entry->cursor); + text_entry_delete_text(entry, + start - entry->text, + end - start); + + return; + } + switch (key) { case XKB_KEY_Tab: key_label = "Tab";