mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 06:16:40 +02:00
buflist: add variable ${index_displayed}
This commit is contained in:
@@ -332,7 +332,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
int item_index, num_buffers, is_channel, is_private, is_list;
|
||||
int i, j, length_max_number, current_buffer, number, prev_number, priority;
|
||||
int rc, count, line_number, line_number_current_buffer;
|
||||
int hotlist_priority_number;
|
||||
int hotlist_priority_number, index_displayed;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -350,6 +350,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
prev_number = -1;
|
||||
line_number = 0;
|
||||
line_number_current_buffer = 0;
|
||||
index_displayed = 0;
|
||||
|
||||
buflist = weechat_string_dyn_alloc (256);
|
||||
|
||||
@@ -658,6 +659,10 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
if (current_buffer)
|
||||
line_number_current_buffer = line_number;
|
||||
prev_number = number;
|
||||
snprintf (str_number, sizeof (str_number), "%d", index_displayed);
|
||||
weechat_hashtable_set (buflist_hashtable_extra_vars,
|
||||
"index_displayed", str_number);
|
||||
index_displayed++;
|
||||
|
||||
/* add newline between each buffer (if needed) */
|
||||
if (weechat_config_boolean (buflist_config_look_add_newline)
|
||||
|
||||
@@ -196,7 +196,10 @@ buflist_command_init (void)
|
||||
"there's no lag (evaluation of option buflist.format.lag)"),
|
||||
N_(" - ${format_tls_version}: indicator of TLS version for a server "
|
||||
"buffer, empty for channels (evaluation of option "
|
||||
"buflist.format.tls_version)")),
|
||||
"buflist.format.tls_version)"),
|
||||
N_(" - ${index_displayed}: index of line displayed in the bar "
|
||||
"item (starts at 0, only buffers displayed increment this index, "
|
||||
"see option buflist.look.display_conditions")),
|
||||
"enable|disable|toggle"
|
||||
" || bar"
|
||||
" || refresh %(buflist_items_used)|%*",
|
||||
|
||||
Reference in New Issue
Block a user