mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 05:16:38 +02:00
buflist: add option buflist.format.indent
This commit is contained in:
@@ -55,14 +55,15 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
char **buflist, *str_buflist, *condition;
|
||||
char str_format_number[32], str_format_number_empty[32];
|
||||
char str_nick_prefix[32];
|
||||
char str_number[32], str_indent_name[4], *line, **hotlist, *str_hotlist;
|
||||
char str_number[32], *line, **hotlist, *str_hotlist;
|
||||
char str_hotlist_count[32];
|
||||
const char *ptr_format, *ptr_format_current, *ptr_name, *ptr_type;
|
||||
const char *ptr_nick, *ptr_nick_prefix;
|
||||
const char *ptr_format, *ptr_format_current, *ptr_format_indent;
|
||||
const char *ptr_name, *ptr_type, *ptr_nick, *ptr_nick_prefix;
|
||||
const char *ptr_hotlist_format, *ptr_hotlist_priority;
|
||||
const char *hotlist_priority_none = "none";
|
||||
const char *hotlist_priority[4] = { "low", "message", "private",
|
||||
"highlight" };
|
||||
const char indent_empty[1] = { '\0' };
|
||||
const char *ptr_lag;
|
||||
int is_channel, is_private;
|
||||
int i, j, length_max_number, current_buffer, number, prev_number, priority;
|
||||
@@ -163,12 +164,11 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
prev_number = number;
|
||||
|
||||
/* buffer name */
|
||||
str_indent_name[0] = '\0';
|
||||
ptr_type = weechat_buffer_get_string (ptr_buffer, "localvar_type");
|
||||
is_channel = (ptr_type && (strcmp (ptr_type, "channel") == 0));
|
||||
is_private = (ptr_type && (strcmp (ptr_type, "private") == 0));
|
||||
if (is_channel || is_private)
|
||||
snprintf (str_indent_name, sizeof (str_indent_name), " ");
|
||||
ptr_format_indent = (is_channel || is_private) ?
|
||||
weechat_config_string (buflist_config_format_indent) : indent_empty;
|
||||
|
||||
/* nick prefix */
|
||||
str_nick_prefix[0] = '\0';
|
||||
@@ -216,7 +216,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
|
||||
weechat_config_string (
|
||||
buflist_config_format_number));
|
||||
weechat_hashtable_set (buflist_hashtable_extra_vars,
|
||||
"indent", str_indent_name);
|
||||
"indent", ptr_format_indent);
|
||||
weechat_hashtable_set (buflist_hashtable_extra_vars,
|
||||
"name", ptr_name);
|
||||
|
||||
|
||||
@@ -98,7 +98,8 @@ buflist_command_init ()
|
||||
" - ${number}: indented number, for example \" 1\" if there "
|
||||
"are between 10 and 99 buffers\n"
|
||||
" - ${indent}: indentation for name (channel and private "
|
||||
"buffers are indented)\n"
|
||||
"buffers are indented) (evaluation of "
|
||||
"option buflist.format.indent)\n"
|
||||
" - ${nick_prefix}: nick prefix for a channel (set only "
|
||||
"if the option buflist.look.nick_prefix is enabled)\n"
|
||||
" - ${name}: the short name (if set), with a fallback on the "
|
||||
|
||||
@@ -49,6 +49,7 @@ struct t_config_option *buflist_config_format_hotlist;
|
||||
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_indent;
|
||||
struct t_config_option *buflist_config_format_lag;
|
||||
struct t_config_option *buflist_config_format_number;
|
||||
|
||||
@@ -303,9 +304,7 @@ buflist_config_init ()
|
||||
"to hide server buffers if they are merged with core buffer: "
|
||||
"\"${buffer.hidden}==0 && ((${type}!=server && "
|
||||
"${buffer.full_name}!=core.weechat) || ${buffer.active}==1)\""),
|
||||
NULL, 0, 0,
|
||||
"${buffer.hidden}==0",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "${buffer.hidden}==0", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
@@ -371,9 +370,7 @@ buflist_config_init ()
|
||||
N_("comma-separated list of fields to sort buffers; each field is "
|
||||
"a hdata variable of buffer; char \"-\" can be used before field "
|
||||
"to reverse order"),
|
||||
NULL, 0, 0,
|
||||
"number,-active",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "number,-active", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_sort, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
@@ -408,9 +405,7 @@ buflist_config_init ()
|
||||
"buffer_current", "string",
|
||||
N_("format for the line with current buffer "
|
||||
"(note: content is evaluated, see /help buflist)"),
|
||||
NULL, 0, 0,
|
||||
"${color:,blue}${format_buffer}",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "${color:,blue}${format_buffer}", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
@@ -430,9 +425,7 @@ buflist_config_init ()
|
||||
"hotlist_low", "string",
|
||||
N_("format for a buffer with hotlist level \"low\" "
|
||||
"(note: content is evaluated, see /help buflist)"),
|
||||
NULL, 0, 0,
|
||||
"${color:white}",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "${color:white}", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
@@ -441,9 +434,7 @@ buflist_config_init ()
|
||||
"hotlist_message", "string",
|
||||
N_("format for a buffer with hotlist level \"message\" "
|
||||
"(note: content is evaluated, see /help buflist)"),
|
||||
NULL, 0, 0,
|
||||
"${color:brown}",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "${color:brown}", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
@@ -452,9 +443,7 @@ buflist_config_init ()
|
||||
"hotlist_private", "string",
|
||||
N_("format for a buffer with hotlist level \"private\" "
|
||||
"(note: content is evaluated, see /help buflist)"),
|
||||
NULL, 0, 0,
|
||||
"${color:green}",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "${color:green}", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
@@ -463,9 +452,7 @@ buflist_config_init ()
|
||||
"hotlist_highlight", "string",
|
||||
N_("format for a buffer with hotlist level \"highlight\" "
|
||||
"(note: content is evaluated, see /help buflist)"),
|
||||
NULL, 0, 0,
|
||||
"${color:magenta}",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "${color:magenta}", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
@@ -474,9 +461,7 @@ buflist_config_init ()
|
||||
"hotlist_none", "string",
|
||||
N_("format for a buffer not in hotlist "
|
||||
"(note: content is evaluated, see /help buflist)"),
|
||||
NULL, 0, 0,
|
||||
"${color:default}",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "${color:default}", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
@@ -485,9 +470,16 @@ buflist_config_init ()
|
||||
"hotlist_separator", "string",
|
||||
N_("separator for counts in hotlist "
|
||||
"(note: content is evaluated, see /help buflist)"),
|
||||
NULL, 0, 0,
|
||||
"${color:default},",
|
||||
NULL, 0,
|
||||
NULL, 0, 0, "${color:default},", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
buflist_config_format_indent = weechat_config_new_option (
|
||||
buflist_config_file, ptr_section,
|
||||
"indent", "string",
|
||||
N_("string displayed to indent channel and private buffers "
|
||||
"(note: content is evaluated, see /help buflist)"),
|
||||
NULL, 0, 0, " ", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&buflist_config_change_buflist, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
@@ -47,6 +47,7 @@ extern struct t_config_option *buflist_config_format_hotlist;
|
||||
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_indent;
|
||||
extern struct t_config_option *buflist_config_format_lag;
|
||||
extern struct t_config_option *buflist_config_format_number;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user