From 9cc6acc9a2baa643e8a7e68176d6caa3ff8b60f4 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 1 Feb 2002 13:56:50 +0000 Subject: [PATCH] Don't eat unknown keys that aren't combinations git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2363 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/keyboard.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 39d7ee18..b3619bba 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -546,7 +546,7 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key) { KEY_REC *rec; char *combo; - int consumed; + int first_key, consumed; g_return_val_if_fail(keyboard != NULL, FALSE); g_return_val_if_fail(key != NULL && *key != '\0', FALSE); @@ -557,6 +557,7 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key) return FALSE; } + first_key = keyboard->key_state == NULL; combo = keyboard->key_state == NULL ? g_strdup(key) : g_strconcat(keyboard->key_state, "-", key, NULL); g_free_and_null(keyboard->key_state); @@ -565,9 +566,10 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key) (GSearchFunc) key_states_search, combo); if (rec == NULL) { - /* unknown key combo, eat the invalid key */ + /* unknown key combo, eat the invalid key + unless it was the first key pressed */ g_free(combo); - return TRUE; + return !first_key; } if (g_tree_lookup(key_states, combo) != rec) {