buflist: add variable ${merged} in bar item evaluation

v2.8-utf8proc
Sébastien Helleu 2017-06-13 20:29:38 +02:00
parent fbf7156b1b
commit 92a40052af
2 changed files with 25 additions and 1 deletions

View File

@ -31,7 +31,7 @@ Improvements::
* core: allow index for hdata arrays in evaluation of expressions
* buflist: display a warning when the script "buffers.pl" is loaded
* buflist: add support of char "~" in option buflist.look.sort for case insensitive comparison
* buflist: add variable `${current_buffer}` (boolean "0" / "1") in bar item evaluation
* buflist: add variables `${current_buffer}` and `${merged}` (booleans "0" / "1") in bar item evaluation
* relay: add option "start" in command /relay
* trigger: add "irc_server" and "irc_channel" pointers in data for IRC signal/modifier hooks

View File

@ -216,6 +216,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
{
struct t_arraylist *buffers;
struct t_gui_buffer *ptr_buffer, *ptr_current_buffer;
struct t_gui_buffer *ptr_buffer_prev, *ptr_buffer_next;
struct t_gui_nick *ptr_gui_nick;
struct t_gui_hotlist *ptr_hotlist;
void *ptr_server, *ptr_channel;
@ -350,6 +351,29 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
}
prev_number = number;
/* buffer merged */
ptr_buffer_prev = weechat_hdata_move (buflist_hdata_buffer,
ptr_buffer, -1);
ptr_buffer_next = weechat_hdata_move (buflist_hdata_buffer,
ptr_buffer, 1);
if ((ptr_buffer_prev
&& (weechat_hdata_integer (buflist_hdata_buffer,
ptr_buffer_prev,
"number") == number))
|| (ptr_buffer_next
&& (weechat_hdata_integer (buflist_hdata_buffer,
ptr_buffer_next,
"number") == number)))
{
weechat_hashtable_set (buflist_hashtable_extra_vars,
"merged", "1");
}
else
{
weechat_hashtable_set (buflist_hashtable_extra_vars,
"merged", "0");
}
/* buffer name */
ptr_type = weechat_buffer_get_string (ptr_buffer, "localvar_type");
is_channel = (ptr_type && (strcmp (ptr_type, "channel") == 0));