diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-05-23 16:07:31 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-05-23 16:07:31 +0000 |
commit | fb3fd5b0eb58db1f53aad2236d4ca25f7a695065 (patch) | |
tree | 6fe155fc4dbe4f4ec659708fea7aa02eb8860d3b /src | |
parent | c0762e3b13686440dfc3e6e10ceee525fc7c2111 (diff) | |
download | weechat-fb3fd5b0eb58db1f53aad2236d4ca25f7a695065.zip |
Improved key bindings: now possible to bind a key on many commands, separated by semicolon (task #5444)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui-keyboard.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c index bf617011c..2c77eae7a 100644 --- a/src/gui/gui-keyboard.c +++ b/src/gui/gui-keyboard.c @@ -552,6 +552,7 @@ gui_keyboard_pressed (char *key_str) int first_key; t_gui_key *ptr_key; char *buffer_before_key; + char **commands, **ptr_cmd; /* add key to buffer */ first_key = (gui_key_buffer[0] == '\0'); @@ -576,9 +577,19 @@ gui_keyboard_pressed (char *key_str) strdup (gui_current_window->buffer->input_buffer) : strdup (""); gui_key_buffer[0] = '\0'; if (ptr_key->command) - user_command (SERVER(gui_current_window->buffer), - CHANNEL(gui_current_window->buffer), - ptr_key->command, 0); + { + commands = split_multi_command (ptr_key->command, ';'); + if (commands) + { + for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++) + { + user_command (SERVER(gui_current_window->buffer), + CHANNEL(gui_current_window->buffer), + *ptr_cmd, 0); + } + free_multi_command (commands); + } + } else (void)(ptr_key->function)(gui_current_window, ptr_key->args); #ifdef PLUGINS |