diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-02-09 20:34:56 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-02-09 20:34:56 +0100 |
commit | 630fe0581f59d4c6266b2149e6ff0b5170115d7b (patch) | |
tree | 5ead8aee724a11f57ea599a0c191b7b13fac7768 /src/plugins/buflist/buflist-bar-item.c | |
parent | d74f2e3183ac59e198b71d4b9f9727f00207bc3c (diff) | |
download | weechat-630fe0581f59d4c6266b2149e6ff0b5170115d7b.zip |
buflist: add option buflist.look.use_items to speed up display of buflist (closes #1613)
Diffstat (limited to 'src/plugins/buflist/buflist-bar-item.c')
-rw-r--r-- | src/plugins/buflist/buflist-bar-item.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c index 89b774d19..88972cf8c 100644 --- a/src/plugins/buflist/buflist-bar-item.c +++ b/src/plugins/buflist/buflist-bar-item.c @@ -103,16 +103,23 @@ buflist_bar_item_get_index_with_pointer (struct t_gui_bar_item *item) /* * Updates buflist bar item if buflist is enabled (or if force argument is 1). + * + * If force == 1, all used items are refreshed + * (according to option buflist.look.use_items). + * If force == 2, all items are refreshed. */ void buflist_bar_item_update (int force) { - int i; + int i, num_items; if (force || weechat_config_boolean (buflist_config_look_enabled)) { - for (i = 0; i < BUFLIST_BAR_NUM_ITEMS; i++) + num_items = (force == 2) ? + BUFLIST_BAR_NUM_ITEMS : + weechat_config_integer (buflist_config_look_use_items); + for (i = 0; i < num_items; i++) { weechat_bar_item_update (buflist_bar_item_get_name (i)); } @@ -318,14 +325,17 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, if (!weechat_config_boolean (buflist_config_look_enabled)) return NULL; + item_index = (int)((unsigned long)pointer); + + if (item_index + 1 > weechat_config_integer (buflist_config_look_use_items)) + return NULL; + prev_number = -1; line_number = 0; line_number_current_buffer = 0; buflist = weechat_string_dyn_alloc (256); - item_index = (int)((unsigned long)pointer); - weechat_hashtable_set (buflist_hashtable_pointers, "bar_item", item); if (window) weechat_hashtable_set (buflist_hashtable_pointers, "window", window); |