diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-08-10 12:24:23 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-08-10 12:24:23 +0200 |
commit | f841333609ab91b011dbe29099078f7599be0f2d (patch) | |
tree | 2014251f2d4f275d0e249d38a81e98915d38bdac /src | |
parent | fe9aee25a5de346e01e7992aba373870eb6f0b4f (diff) | |
download | weechat-f841333609ab91b011dbe29099078f7599be0f2d.zip |
core: allow mix of commands and hsignals for keys in context "mouse"
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui-key.c | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 6e70d072a..959060f87 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -771,67 +771,62 @@ gui_key_focus_command (const char *key, int context, if (!matching) continue; + if ((context == GUI_KEY_CONTEXT_CURSOR) && gui_cursor_debug) + { + gui_input_delete_line (gui_current_window->buffer); + } + hashtable = hook_focus_get_data (focus_info1, focus_info2, key); if (debug) { - gui_chat_printf (NULL, "Hashtable focus: %s", + gui_chat_printf (NULL, _("Hashtable focus: %s"), hashtable_get_string (hashtable, "keys_values_sorted")); + gui_chat_printf (NULL, _("Command for key: \"%s\""), + ptr_key->command); } - if (string_strncasecmp (ptr_key->command, "hsignal:", 8) == 0) - { - if (ptr_key->command[8]) - { - if (debug) - { - gui_chat_printf (NULL, "Sending hsignal \"%s\"", - ptr_key->command + 8); - } - hook_hsignal_send (ptr_key->command + 8, hashtable); - } - } - else + commands = string_split_command (ptr_key->command, ';'); + if (commands) { - command = string_replace_with_hashtable (ptr_key->command, - hashtable, - &errors); - if (command) + for (i = 0; commands[i]; i++) { - if (errors == 0) + if (string_strncasecmp (commands[i], "hsignal:", 8) == 0) { - if (debug) - { - gui_chat_printf (NULL, - "Executing command: %s (%s)", - command, ptr_key->command); - } - if ((context == GUI_KEY_CONTEXT_CURSOR) && gui_cursor_debug) + if (commands[i][8]) { - gui_input_delete_line (gui_current_window->buffer); - } - commands = string_split_command (command, ';'); - if (commands) - { - for (i = 0; commands[i]; i++) + if (debug) { - input_data (gui_current_window->buffer, commands[i]); + gui_chat_printf (NULL, + _("Sending hsignal: \"%s\""), + commands[i] + 8); } - string_free_split_command (commands); + hook_hsignal_send (commands[i] + 8, hashtable); } } else { - if (debug) + command = string_replace_with_hashtable (commands[i], + hashtable, + &errors); + if (command) { - gui_chat_printf (NULL, - "Command NOT executed (%s)", - ptr_key->command); + if (errors == 0) + { + if (debug) + { + gui_chat_printf (NULL, + _("Executing command: \"%s\""), + command); + } + input_data (gui_current_window->buffer, command); + } + free (command); } } - free (command); } + string_free_split_command (commands); } if (hashtable) hashtable_free (hashtable); |