diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-05-25 18:57:26 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-05-25 18:57:26 +0000 |
commit | 0a9e7af938236e5cda155e6e69ddfa96404d97c3 (patch) | |
tree | 0b04113eb8c80c70a991a0f66c2906ae5710295b /usr.bin/tmux/key-string.c | |
parent | 7bc8779f6c3e9964ccc6c05df20fe72b300378ac (diff) |
Use the internal representation for UTF-8 keys instead of wchar_t and
drop some code only needed for that.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r-- | usr.bin/tmux/key-string.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index 548f32de04f..83bbcb24376 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.60 2020/05/20 07:11:45 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.61 2020/05/25 18:57:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -169,7 +169,7 @@ key_string_lookup_string(const char *string) struct utf8_data ud; u_int i; enum utf8_state more; - wchar_t wc; + utf8_char uc; /* Is this no key or any key? */ if (strcasecmp(string, "None") == 0) @@ -210,9 +210,9 @@ key_string_lookup_string(const char *string) more = utf8_append(&ud, (u_char)string[i]); if (more != UTF8_DONE) return (KEYC_UNKNOWN); - if (utf8_combine(&ud, &wc) != UTF8_DONE) + if (utf8_from_data(&ud, &uc) != UTF8_DONE) return (KEYC_UNKNOWN); - return (wc|modifiers); + return (uc|modifiers); } /* Otherwise look the key up in the table. */ @@ -349,12 +349,11 @@ key_string_lookup_key(key_code key, int with_flags) /* Is this a UTF-8 key? */ if (key > 127 && key < KEYC_BASE) { - if (utf8_split(key, &ud) == UTF8_DONE) { - off = strlen(out); - memcpy(out + off, ud.data, ud.size); - out[off + ud.size] = '\0'; - goto out; - } + utf8_to_data(key, &ud); + off = strlen(out); + memcpy(out + off, ud.data, ud.size); + out[off + ud.size] = '\0'; + goto out; } /* Invalid keys are errors. */ |