From 55be71a726a82d2d6c2afbfc4b43299379ee75b2 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 12 Aug 2001 17:02:06 +0000 Subject: [PATCH] Bugfix to keyb. code :) And now the "key" names can contain only alphanumeric + '_' characters, which makes /BIND foo meta-5~ work again because 5~ are treated separately, not as one "key" name. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1739 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/keyboard.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 1fd15d5b..bfcba6d0 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -261,7 +261,19 @@ static int expand_key(const char *key, GSList **out) /* meta-^W^Gf -> ^[-^W-^G-f */ start = NULL; last_hyphen = TRUE; - for (; *key != '\0'; key++) { + for (; *key != '\0'; key++) { + if (start != NULL) { + if (isalnum(*key) || *key == '_') { + /* key combo continues */ + continue; + } + + if (!expand_combo(start, key-1, out)) + return FALSE; + expand_out_char(*out, '-'); + start = NULL; + } + if (*key == '-') { if (last_hyphen) { expand_out_char(*out, '-'); @@ -279,18 +291,10 @@ static int expand_key(const char *key, GSList **out) last_hyphen = TRUE; } else { /* key / combo */ - if (start == NULL) - start = key; + start = key; last_hyphen = FALSE; continue; } - - if (start != NULL) { - if (!expand_combo(start, key-1, out)) - return FALSE; - expand_out_char(*out, '-'); - start = NULL; - } } if (start != NULL)