From 0fc752528f9c2e0de500f470c6b8c5884d67a1a0 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 19 Nov 2001 23:56:00 +0000 Subject: [PATCH] /BIND works a bit better again when parsing the given key. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2110 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/keyboard.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 482f92b5..bba8e4dd 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -265,8 +265,7 @@ static int expand_key(const char *key, GSList **out) start = NULL; last_hyphen = TRUE; for (; *key != '\0'; key++) { if (start != NULL) { - if (!isdigit(*start) && - (isalnum(*key) || *key == '_')) { + if (isalnum(*key) || *key == '_') { /* key combo continues */ continue; } @@ -292,11 +291,14 @@ static int expand_key(const char *key, GSList **out) expand_out_char(*out, *key); expand_out_char(*out, '-'); last_hyphen = FALSE; /* optional */ - } else { - /* key / combo */ + } else if (last_hyphen && isalnum(*key) && !isdigit(*key)) { + /* possibly beginning of keycombo */ start = key; last_hyphen = FALSE; - continue; + } else { + expand_out_char(*out, *key); + expand_out_char(*out, '-'); + last_hyphen = FALSE; /* optional */ } } @@ -798,6 +800,10 @@ static void read_keyboard_config(void) void keyboard_init(void) { + GSList *l; + + l = NULL; + expand_key("^[[5D", &l); keys = g_hash_table_new((GHashFunc) g_str_hash, (GCompareFunc) g_str_equal); default_keys = g_hash_table_new((GHashFunc) g_str_hash,