mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 03:33:12 +02:00
fset: add ${parent_value}, add options fset.color.parent_value and fset.color.parent_value_selected
This commit is contained in:
@@ -242,7 +242,7 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
|
||||
weechat_color ("default"),
|
||||
(add_quotes_parent) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
|
||||
(add_quotes_parent) ? "\"" : "",
|
||||
weechat_color (weechat_config_string (fset_config_color_value[selected_line])),
|
||||
weechat_color (weechat_config_string (fset_config_color_parent_value[selected_line])),
|
||||
(ptr_parent_value) ? ptr_parent_value : FSET_OPTION_VALUE_NULL,
|
||||
(add_quotes_parent) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
|
||||
(add_quotes_parent) ? "\"" : "");
|
||||
@@ -274,6 +274,41 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
|
||||
"value2", str_field);
|
||||
}
|
||||
|
||||
/* parent_value (set only if value is NULL and inherited from parent) */
|
||||
if (value_undef && ptr_parent_value)
|
||||
{
|
||||
add_quotes_parent = (ptr_parent_value && (strcmp (fset_option->type, "string") == 0)) ? 1 : 0;
|
||||
snprintf (str_field, sizeof (str_field),
|
||||
"%s",
|
||||
(ptr_parent_value) ? ptr_parent_value : FSET_OPTION_VALUE_NULL);
|
||||
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
|
||||
"__parent_value", str_field);
|
||||
snprintf (str_field, sizeof (str_field),
|
||||
"%s%s%s%s%s%s",
|
||||
(add_quotes_parent) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
|
||||
(add_quotes_parent) ? "\"" : "",
|
||||
weechat_color (weechat_config_string (fset_config_color_parent_value[selected_line])),
|
||||
(ptr_parent_value) ? ptr_parent_value : FSET_OPTION_VALUE_NULL,
|
||||
(add_quotes_parent) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
|
||||
(add_quotes_parent) ? "\"" : "");
|
||||
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
|
||||
"_parent_value", str_field);
|
||||
fset_buffer_fills_field (str_field, sizeof (str_field), "parent_value", 16);
|
||||
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
|
||||
"parent_value", str_field);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_field[0] = '\0';
|
||||
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
|
||||
"__parent_value", str_field);
|
||||
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
|
||||
"_parent_value", str_field);
|
||||
fset_buffer_fills_field (str_field, sizeof (str_field), "parent_value", 16);
|
||||
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
|
||||
"parent_value", str_field);
|
||||
}
|
||||
|
||||
/* min */
|
||||
ptr_field = weechat_hdata_string (fset_hdata_fset_option,
|
||||
fset_option, "min");
|
||||
|
||||
@@ -57,6 +57,7 @@ struct t_config_option *fset_config_color_max[2];
|
||||
struct t_config_option *fset_config_color_min[2];
|
||||
struct t_config_option *fset_config_color_name[2];
|
||||
struct t_config_option *fset_config_color_parent_name[2];
|
||||
struct t_config_option *fset_config_color_parent_value[2];
|
||||
struct t_config_option *fset_config_color_quotes[2];
|
||||
struct t_config_option *fset_config_color_string_values[2];
|
||||
struct t_config_option *fset_config_color_type[2];
|
||||
@@ -423,6 +424,22 @@ fset_config_init ()
|
||||
NULL, NULL, NULL,
|
||||
&fset_config_change_color, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
fset_config_color_parent_value[0] = weechat_config_new_option (
|
||||
fset_config_file, ptr_section,
|
||||
"parent_value", "color",
|
||||
N_("color for parent value"),
|
||||
NULL, 0, 0, "cyan", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&fset_config_change_color, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
fset_config_color_parent_value[1] = weechat_config_new_option (
|
||||
fset_config_file, ptr_section,
|
||||
"parent_value_selected", "color",
|
||||
N_("color for parent value on the selected line"),
|
||||
NULL, 0, 0, "lightcyan", NULL, 0,
|
||||
NULL, NULL, NULL,
|
||||
&fset_config_change_color, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
fset_config_color_quotes[0] = weechat_config_new_option (
|
||||
fset_config_file, ptr_section,
|
||||
"quotes", "color",
|
||||
|
||||
@@ -44,6 +44,7 @@ extern struct t_config_option *fset_config_color_max[2];
|
||||
extern struct t_config_option *fset_config_color_min[2];
|
||||
extern struct t_config_option *fset_config_color_name[2];
|
||||
extern struct t_config_option *fset_config_color_parent_name[2];
|
||||
extern struct t_config_option *fset_config_color_parent_value[2];
|
||||
extern struct t_config_option *fset_config_color_quotes[2];
|
||||
extern struct t_config_option *fset_config_color_string_values[2];
|
||||
extern struct t_config_option *fset_config_color_type[2];
|
||||
|
||||
Reference in New Issue
Block a user