summaryrefslogtreecommitdiff
path: root/src/plugins/buflist/buflist-command.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-10-01 09:58:19 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-10-01 09:58:19 +0200
commite928bce76cca4c4b21bc1e7b78b8ae032e5109b0 (patch)
treee3cdd90814e226161751fd8b166d4cd8d2eb8688 /src/plugins/buflist/buflist-command.c
parent8bd4994ccd9a7a2296969b57894d765b69115199 (diff)
downloadweechat-e928bce76cca4c4b21bc1e7b78b8ae032e5109b0.zip
buflist: add support of item names in command `/buflist refresh`
Diffstat (limited to 'src/plugins/buflist/buflist-command.c')
-rw-r--r--src/plugins/buflist/buflist-command.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/plugins/buflist/buflist-command.c b/src/plugins/buflist/buflist-command.c
index 5aa346f1e..f86d0e5fd 100644
--- a/src/plugins/buflist/buflist-command.c
+++ b/src/plugins/buflist/buflist-command.c
@@ -37,6 +37,8 @@ buflist_command_buflist (const void *pointer, void *data,
struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
+ int i, index;
+
/* make C compiler happy */
(void) pointer;
(void) data;
@@ -72,7 +74,20 @@ buflist_command_buflist (const void *pointer, void *data,
if (weechat_strcmp (argv[1], "refresh") == 0)
{
- buflist_bar_item_update (0);
+ if (argc > 2)
+ {
+ for (i = 2; i < argc; i++)
+ {
+ index = buflist_bar_item_get_index (argv[i]);
+ if (index >= 0)
+ buflist_bar_item_update (index, 0);
+ }
+ }
+ else
+ {
+ /* refresh all bar items used */
+ buflist_bar_item_update (-1, 0);
+ }
return WEECHAT_RC_OK;
}
@@ -89,13 +104,16 @@ buflist_command_init ()
weechat_hook_command (
"buflist",
N_("bar item with list of buffers"),
- "enable|disable|toggle || bar || refresh",
+ "enable|disable|toggle"
+ " || bar"
+ " || refresh [<item>[,<item>...]]",
N_(" enable: enable buflist\n"
"disable: disable buflist\n"
" toggle: toggle buflist\n"
" bar: add the \"buflist\" bar\n"
- "refresh: force the refresh of the bar items (buflist, buflist2 "
- "buflist3, buflist4 and buflist5)\n"
+ "refresh: force the refresh of some bar items (if no item is given, "
+ "all bar items used are refreshed, according to option "
+ "buflist.look.use_items)\n"
"\n"
"The lines with buffers are displayed using string evaluation "
"(see /help eval for the format), with these options:\n"
@@ -174,6 +192,8 @@ buflist_command_init ()
" - ${format_tls_version}: indicator of TLS version for a server "
"buffer, empty for channels (evaluation of option "
"buflist.format.tls_version)"),
- "enable|disable|toggle || bar || refresh",
+ "enable|disable|toggle"
+ " || bar"
+ " || refresh %(buflist_used_items)|%*",
&buflist_command_buflist, NULL, NULL);
}