mirror of
https://github.com/irssi/irssi.git
synced 2024-09-08 04:26:01 -04:00
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
This commit is contained in:
parent
4f5f17e94a
commit
9cc6acc9a2
@ -546,7 +546,7 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key)
|
|||||||
{
|
{
|
||||||
KEY_REC *rec;
|
KEY_REC *rec;
|
||||||
char *combo;
|
char *combo;
|
||||||
int consumed;
|
int first_key, consumed;
|
||||||
|
|
||||||
g_return_val_if_fail(keyboard != NULL, FALSE);
|
g_return_val_if_fail(keyboard != NULL, FALSE);
|
||||||
g_return_val_if_fail(key != NULL && *key != '\0', 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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
first_key = keyboard->key_state == NULL;
|
||||||
combo = keyboard->key_state == NULL ? g_strdup(key) :
|
combo = keyboard->key_state == NULL ? g_strdup(key) :
|
||||||
g_strconcat(keyboard->key_state, "-", key, NULL);
|
g_strconcat(keyboard->key_state, "-", key, NULL);
|
||||||
g_free_and_null(keyboard->key_state);
|
g_free_and_null(keyboard->key_state);
|
||||||
@ -565,9 +566,10 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key)
|
|||||||
(GSearchFunc) key_states_search,
|
(GSearchFunc) key_states_search,
|
||||||
combo);
|
combo);
|
||||||
if (rec == NULL) {
|
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);
|
g_free(combo);
|
||||||
return TRUE;
|
return !first_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_tree_lookup(key_states, combo) != rec) {
|
if (g_tree_lookup(key_states, combo) != rec) {
|
||||||
|
Loading…
Reference in New Issue
Block a user