1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 07:46:38 +02:00

buflist: add option buflist.format.number

This commit is contained in:
Sébastien Helleu
2017-03-29 20:00:36 +02:00
parent 454a4b14b2
commit 0436fff31b
29 changed files with 226 additions and 44 deletions
+8
View File
@@ -138,11 +138,15 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
{
snprintf (str_number, sizeof (str_number),
str_format_number, number);
weechat_hashtable_set (buflist_hashtable_extra_vars,
"number_displayed", "1");
}
else
{
snprintf (str_number, sizeof (str_number),
str_format_number_empty, " ");
weechat_hashtable_set (buflist_hashtable_extra_vars,
"number_displayed", "0");
}
prev_number = number;
@@ -163,6 +167,10 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
buflist_config_format_buffer));
weechat_hashtable_set (buflist_hashtable_extra_vars,
"number", str_number);
weechat_hashtable_set (buflist_hashtable_extra_vars,
"format_number",
weechat_config_string (
buflist_config_format_number));
weechat_hashtable_set (buflist_hashtable_extra_vars,
"indent", str_indent_name);
weechat_hashtable_set (buflist_hashtable_extra_vars,
+2
View File
@@ -93,6 +93,8 @@ buflist_command_init ()
"buflist.format.buffer; this can be used in option "
"buflist.format.buffer_current to just change the background color "
"for example\n"
" - ${format_number}: indented number with separator "
"(evaluation of option buflist.format.number)\n"
" - ${number}: indented number, for example \" 1\" if there "
"are between 10 and 99 buffers\n"
" - ${indent}: indentation for name (channel and private "
+14 -2
View File
@@ -44,6 +44,7 @@ struct t_config_option *buflist_config_format_hotlist_level[4];
struct t_config_option *buflist_config_format_hotlist_level_none;
struct t_config_option *buflist_config_format_hotlist_separator;
struct t_config_option *buflist_config_format_lag;
struct t_config_option *buflist_config_format_number;
struct t_hook **buflist_config_signals_refresh = NULL;
int buflist_config_num_signals_refresh = 0;
@@ -264,7 +265,7 @@ buflist_config_init ()
N_("format of each line with a buffer "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0,
"${color:green}${number}.${indent}${color_hotlist}${name}",
"${format_number}${indent}${color_hotlist}${name}",
NULL, 0,
NULL, NULL, NULL,
&buflist_config_change_buflist, NULL, NULL,
@@ -275,7 +276,7 @@ buflist_config_init ()
N_("format for the line with current buffer "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0,
"${color:lightgreen,blue}${number}.${indent}${color_hotlist}${name}",
"${color:lightgreen,blue}${format_buffer}",
NULL, 0,
NULL, NULL, NULL,
&buflist_config_change_buflist, NULL, NULL,
@@ -368,6 +369,17 @@ buflist_config_init ()
NULL, NULL, NULL,
&buflist_config_change_buflist, NULL, NULL,
NULL, NULL, NULL);
buflist_config_format_number = weechat_config_new_option (
buflist_config_file, ptr_section,
"number", "string",
N_("format for buffer number, ${number} is the indented number "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0,
"${color:green}${number}${if:${number_displayed}?.: }",
NULL, 0,
NULL, NULL, NULL,
&buflist_config_change_buflist, NULL, NULL,
NULL, NULL, NULL);
return 1;
}
+1
View File
@@ -35,6 +35,7 @@ extern struct t_config_option *buflist_config_format_hotlist_level[4];
extern struct t_config_option *buflist_config_format_hotlist_level_none;
extern struct t_config_option *buflist_config_format_hotlist_separator;
extern struct t_config_option *buflist_config_format_lag;
extern struct t_config_option *buflist_config_format_number;
extern char **buflist_config_sort_fields;
extern int buflist_config_sort_fields_count;