mirror of
https://github.com/tmate-io/tmate.git
synced 2026-01-23 02:24:06 +00:00
Handle wcwidth() and mbtowc() failures in better style and drop
characters where we can't find the width (wcwidth() fails) on input, the same as we drop invalid UTF-8. Suggested by schwarze@.
This commit is contained in:
parent
d980d965dd
commit
b8a102d26f
5 changed files with 48 additions and 21 deletions
|
|
@ -149,6 +149,7 @@ key_string_lookup_string(const char *string)
|
|||
struct utf8_data ud;
|
||||
u_int i;
|
||||
enum utf8_state more;
|
||||
wchar_t wc;
|
||||
|
||||
/* Is this no key? */
|
||||
if (strcasecmp(string, "None") == 0)
|
||||
|
|
@ -185,8 +186,9 @@ key_string_lookup_string(const char *string)
|
|||
more = utf8_append(&ud, (u_char)string[i]);
|
||||
if (more != UTF8_DONE)
|
||||
return (KEYC_UNKNOWN);
|
||||
key = utf8_combine(&ud);
|
||||
return (key | modifiers);
|
||||
if (utf8_combine(&ud, &wc) != UTF8_DONE)
|
||||
return (KEYC_UNKNOWN);
|
||||
return (wc | modifiers);
|
||||
}
|
||||
|
||||
/* Otherwise look the key up in the table. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue