mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
It's now possible to stop single character /BINDs from printing to input
line. Hiascii characters didn't work properly with /BIND. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1792 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
f4fdd56890
commit
3432f02a05
@ -524,7 +524,8 @@ static int key_emit_signal(KEYBOARD_REC *keyboard, KEY_REC *key)
|
|||||||
return consumed;
|
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') {
|
while (*search != '\0') {
|
||||||
if (*combo != *search)
|
if (*combo != *search)
|
||||||
@ -541,13 +542,13 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key)
|
|||||||
{
|
{
|
||||||
KEY_REC *rec;
|
KEY_REC *rec;
|
||||||
char *combo;
|
char *combo;
|
||||||
int consumed, single_key;
|
int 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);
|
||||||
|
|
||||||
single_key = keyboard->key_state == NULL && key[1] == '\0';
|
if (keyboard->key_state == NULL && key[1] == '\0' &&
|
||||||
if (single_key && !used_keys[(int) (unsigned char) key[0]]) {
|
!used_keys[(int) (unsigned char) key[0]]) {
|
||||||
/* fast check - key not used */
|
/* fast check - key not used */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -576,7 +577,7 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key)
|
|||||||
consumed = key_emit_signal(keyboard, rec);
|
consumed = key_emit_signal(keyboard, rec);
|
||||||
|
|
||||||
/* never consume non-control characters */
|
/* never consume non-control characters */
|
||||||
return consumed && !single_key;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyboard_entry_redirect(SIGNAL_FUNC func, const char *entry,
|
void keyboard_entry_redirect(SIGNAL_FUNC func, const char *entry,
|
||||||
|
@ -505,6 +505,7 @@ void gui_readline_init(void)
|
|||||||
keyboard = keyboard_create(NULL);
|
keyboard = keyboard_create(NULL);
|
||||||
key_configure_freeze();
|
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, "^M", "return", (SIGNAL_FUNC) key_combo);
|
||||||
key_bind("key", NULL, "^J", "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 */
|
/* line transmitting */
|
||||||
key_bind("send_line", "Execute the input line", "return", NULL, (SIGNAL_FUNC) key_send_line);
|
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("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", "Check word replaces", NULL, NULL, (SIGNAL_FUNC) key_check_replaces);
|
||||||
key_bind("check_replaces", NULL, NULL, NULL, (SIGNAL_FUNC) key_check_replaces);
|
|
||||||
|
|
||||||
/* window managing */
|
/* window managing */
|
||||||
key_bind("previous_window", "Previous window", "^P", NULL, (SIGNAL_FUNC) key_previous_window);
|
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("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, "return", "check_replaces;send_line", NULL);
|
||||||
|
key_bind("multi", NULL, "space", "check_replaces;insert_text ", NULL);
|
||||||
|
|
||||||
for (n = 0; changekeys[n] != '\0'; n++) {
|
for (n = 0; changekeys[n] != '\0'; n++) {
|
||||||
key = g_strdup_printf("meta-%c", changekeys[n]);
|
key = g_strdup_printf("meta-%c", changekeys[n]);
|
||||||
|
Loading…
Reference in New Issue
Block a user