1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 11:13:12 +02:00

fset: add ${parent_value}, add options fset.color.parent_value and fset.color.parent_value_selected

This commit is contained in:
Sébastien Helleu
2017-05-31 20:37:13 +02:00
parent 8c7b4282ae
commit 77391dda1b
3 changed files with 54 additions and 1 deletions
+36 -1
View File
@@ -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");