1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

core: display focus hashtable for debug even if no key is matching

This commit is contained in:
Sébastien Helleu
2023-07-08 13:26:44 +02:00
parent 5b2cf75f6e
commit 89137552a7
2 changed files with 39 additions and 18 deletions
+1
View File
@@ -30,6 +30,7 @@ Bug fixes::
* core: add key ctrl-backspace in /help key (issue #1975)
* core: keep keys ctrl-H and ctrl-? (in lower case) if they were manually bound to custom commands in a previous version
* core: fix cursor position after `/plugin list -i` or `/plugin list -il`
* core: display focus hashtable for debug even if no key is matching
* fset: remove extra spaces between min and max values when second format is used
* irc: fix display of country code in message 344 received as whois geo info (issue #1736)
* script: fix cursor position after `/script list -i` or `/script list -il`
+38 -18
View File
@@ -2002,6 +2002,31 @@ gui_key_focus_matching (struct t_gui_key *key,
return match[0] && match[1];
}
/*
* Displays focus hashtable (for debug).
*/
void
gui_key_focus_display_hashtable (struct t_hashtable *hashtable)
{
struct t_weelist *list_keys;
struct t_weelist_item *ptr_item;
gui_chat_printf (NULL, _("Hashtable focus:"));
list_keys = hashtable_get_list_keys (hashtable);
if (list_keys)
{
for (ptr_item = list_keys->items; ptr_item;
ptr_item = ptr_item->next_item)
{
gui_chat_printf (NULL, " %s: \"%s\"",
ptr_item->data,
hashtable_get (hashtable, ptr_item->data));
}
weelist_free (list_keys);
}
}
/*
* Runs command according to focus.
*
@@ -2020,8 +2045,6 @@ gui_key_focus_command (const char *key, int context,
char *command, **commands;
const char *str_buffer;
struct t_hashtable *hashtable;
struct t_weelist *list_keys;
struct t_weelist_item *ptr_item;
struct t_gui_buffer *ptr_buffer;
debug = 0;
@@ -2088,24 +2111,10 @@ gui_key_focus_command (const char *key, int context,
gui_input_delete_line (gui_current_window->buffer);
}
if (debug > 1)
{
gui_chat_printf (NULL, _("Hashtable focus:"));
list_keys = hashtable_get_list_keys (hashtable);
if (list_keys)
{
for (ptr_item = list_keys->items; ptr_item;
ptr_item = ptr_item->next_item)
{
gui_chat_printf (NULL, " %s: \"%s\"",
ptr_item->data,
hashtable_get (hashtable, ptr_item->data));
}
weelist_free (list_keys);
}
}
if (debug)
{
if (debug > 1)
gui_key_focus_display_hashtable (hashtable);
gui_chat_printf (NULL, _("Command for key: \"%s\""),
ptr_key->command);
}
@@ -2156,6 +2165,17 @@ gui_key_focus_command (const char *key, int context,
return 1;
}
if (debug > 1)
{
hashtable = hook_focus_get_data (hashtable_focus[0],
hashtable_focus[1]);
if (hashtable)
{
gui_key_focus_display_hashtable (hashtable);
hashtable_free (hashtable);
}
}
return 0;
}