diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 01dd43c9..f69edacc 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -524,7 +524,8 @@ static int key_emit_signal(KEYBOARD_REC *keyboard, KEY_REC *key) return consumed; } -static int key_states_search(const char *combo, const char *search) +static int key_states_search(const unsigned char *combo, + const unsigned char *search) { while (*search != '\0') { if (*combo != *search) @@ -541,13 +542,13 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key) { KEY_REC *rec; char *combo; - int consumed, single_key; + int consumed; g_return_val_if_fail(keyboard != NULL, FALSE); g_return_val_if_fail(key != NULL && *key != '\0', FALSE); - single_key = keyboard->key_state == NULL && key[1] == '\0'; - if (single_key && !used_keys[(int) (unsigned char) key[0]]) { + if (keyboard->key_state == NULL && key[1] == '\0' && + !used_keys[(int) (unsigned char) key[0]]) { /* fast check - key not used */ return FALSE; } @@ -576,7 +577,7 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key) consumed = key_emit_signal(keyboard, rec); /* never consume non-control characters */ - return consumed && !single_key; + return consumed; } void keyboard_entry_redirect(SIGNAL_FUNC func, const char *entry, diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index c28daed1..c44be58f 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -505,6 +505,7 @@ void gui_readline_init(void) keyboard = keyboard_create(NULL); key_configure_freeze(); + key_bind("key", NULL, " ", "space", (SIGNAL_FUNC) key_combo); key_bind("key", NULL, "^M", "return", (SIGNAL_FUNC) key_combo); key_bind("key", NULL, "^J", "return", (SIGNAL_FUNC) key_combo); @@ -567,8 +568,7 @@ void gui_readline_init(void) /* line transmitting */ key_bind("send_line", "Execute the input line", "return", NULL, (SIGNAL_FUNC) key_send_line); key_bind("word_completion", "", "^I", NULL, (SIGNAL_FUNC) key_word_completion); - key_bind("check_replaces", "Check word replaces", " ", NULL, (SIGNAL_FUNC) key_check_replaces); - key_bind("check_replaces", NULL, NULL, NULL, (SIGNAL_FUNC) key_check_replaces); + key_bind("check_replaces", "Check word replaces", NULL, NULL, (SIGNAL_FUNC) key_check_replaces); /* window managing */ key_bind("previous_window", "Previous window", "^P", NULL, (SIGNAL_FUNC) key_previous_window); @@ -593,6 +593,7 @@ void gui_readline_init(void) key_bind("insert_text", "Append text to line", NULL, NULL, (SIGNAL_FUNC) key_insert_text); key_bind("multi", NULL, "return", "check_replaces;send_line", NULL); + key_bind("multi", NULL, "space", "check_replaces;insert_text ", NULL); for (n = 0; changekeys[n] != '\0'; n++) { key = g_strdup_printf("meta-%c", changekeys[n]);