summaryrefslogtreecommitdiff
path: root/clients/keyboard.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-08-15 11:37:09 -0700
committerKristian Høgsberg <krh@bitplanet.net>2013-08-15 11:37:14 -0700
commit20ffdffc03deaf9eccb23b24d042b089e75ac0a5 (patch)
treebbf580b7509c5911ab57d2fa1eae55e28ea6f072 /clients/keyboard.c
parent0a8461b95e470b9b413cb253f90e088c500e5a44 (diff)
downloadweston-20ffdffc03deaf9eccb23b24d042b089e75ac0a5.tar.gz
weston-20ffdffc03deaf9eccb23b24d042b089e75ac0a5.tar.bz2
weston-20ffdffc03deaf9eccb23b24d042b089e75ac0a5.zip
keyboard: Don't use next_utf8_char() to go back where we came from
We go one utf8 char back and then one forward. Just remember the original position instead, which also avoids a warning about potentially dereferencing a NULL return value from next_utf8_char().
Diffstat (limited to 'clients/keyboard.c')
-rw-r--r--clients/keyboard.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/clients/keyboard.c b/clients/keyboard.c
index 9c5cbc5a..a6f7010a 100644
--- a/clients/keyboard.c
+++ b/clients/keyboard.c
@@ -456,16 +456,6 @@ prev_utf8_char(const char *s, const char *p)
return NULL;
}
-static const char *
-next_utf8_char(const char *p)
-{
- if (*p == '\0')
- return NULL;
- for (++p; (*p & 0xc0) == 0x80; ++p)
- ;
- return p;
-}
-
static void
delete_before_cursor(struct virtual_keyboard *keyboard)
{
@@ -483,7 +473,7 @@ delete_before_cursor(struct virtual_keyboard *keyboard)
return;
}
- end = next_utf8_char(start);
+ end = keyboard->surrounding_text + keyboard->surrounding_cursor;
wl_input_method_context_delete_surrounding_text(keyboard->context,
(start - keyboard->surrounding_text) - keyboard->surrounding_cursor,