diff options
author | Marien Zwart <marien.zwart@gmail.com> | 2014-01-10 13:49:35 +0100 |
---|---|---|
committer | Alexander Færøy <ahf@0x90.dk> | 2014-06-15 22:01:18 +0200 |
commit | 279db87d3201ba10c229ad703a96e50b55aadc65 (patch) | |
tree | 36397447232125dc938a8bf5a0a2737c9ec47ba7 /src | |
parent | b8d748a2482155f4b0ed3c749be6b06793ee26d4 (diff) | |
download | irssi-279db87d3201ba10c229ad703a96e50b55aadc65.zip |
Add support for utf8 chars to /bind
Fixes: #18
Fixes: bio#553
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/keyboard.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 94c6bfd7..67a8d09b 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -304,6 +304,20 @@ static int expand_key(const char *key, GSList **out) /* possibly beginning of keycombo */ start = key; last_hyphen = FALSE; + } else if (g_utf8_validate(key, -1, NULL)) { + /* Assume we are looking at the start of a + * multibyte sequence we will receive as-is, + * so add it to the list as-is. + */ + const char *p, *end = g_utf8_next_char(key); + for (p = key; p != end; p++) + expand_out_char(*out, *p); + expand_out_char(*out, '-'); + /* The for loop skips past the remaining character. + * Nasty, I know... + */ + key = end - 1; + last_hyphen = FALSE; } else { expand_out_char(*out, *key); expand_out_char(*out, '-'); |