aboutsummaryrefslogtreecommitdiff
path: root/termkey.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2011-04-07 20:19:34 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2011-04-07 20:19:34 +0100
commit0a101ff71eb1133889b5f1b28b7779832eddb013 (patch)
tree08a7d3e0890b9ccd05c5966ca949fb4da275cbfd /termkey.c
parentc626393aeb80b5df6ddde8ba3196d0950566190f (diff)
downloadtermo-0a101ff71eb1133889b5f1b28b7779832eddb013.tar.gz
termo-0a101ff71eb1133889b5f1b28b7779832eddb013.tar.xz
termo-0a101ff71eb1133889b5f1b28b7779832eddb013.zip
Bugfix termkey_strpkey parsing unicode with trailing content
Diffstat (limited to 'termkey.c')
-rw-r--r--termkey.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/termkey.c b/termkey.c
index 384b5a4..83d784d 100644
--- a/termkey.c
+++ b/termkey.c
@@ -1124,13 +1124,7 @@ char *termkey_strpkey(TermKey *tk, const char *str, TermKeyKey *key, TermKeyForm
size_t nbytes;
char *endstr;
- if(parse_utf8((unsigned char *)str, strlen(str), &key->code.codepoint, &nbytes) == TERMKEY_RES_KEY &&
- nbytes == strlen(str)) {
- key->type = TERMKEY_TYPE_UNICODE;
- fill_utf8(key);
- str += nbytes;
- }
- else if((endstr = termkey_lookup_keyname(tk, str, &key->code.sym))) {
+ if((endstr = termkey_lookup_keyname(tk, str, &key->code.sym))) {
key->type = TERMKEY_TYPE_KEYSYM;
str = endstr;
}
@@ -1138,6 +1132,12 @@ char *termkey_strpkey(TermKey *tk, const char *str, TermKeyKey *key, TermKeyForm
key->type = TERMKEY_TYPE_FUNCTION;
str += nbytes;
}
+ // Unicode must be last
+ else if(parse_utf8((unsigned char *)str, strlen(str), &key->code.codepoint, &nbytes) == TERMKEY_RES_KEY) {
+ key->type = TERMKEY_TYPE_UNICODE;
+ fill_utf8(key);
+ str += nbytes;
+ }
// TODO: Consider mouse events?
else
return NULL;