diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c index 5ed1ffba5..9b2e222e2 100644 --- a/src/plugins/fset/fset-buffer.c +++ b/src/plugins/fset/fset-buffer.c @@ -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"); diff --git a/src/plugins/fset/fset-config.c b/src/plugins/fset/fset-config.c index 059339cd0..8ab295bfc 100644 --- a/src/plugins/fset/fset-config.c +++ b/src/plugins/fset/fset-config.c @@ -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", diff --git a/src/plugins/fset/fset-config.h b/src/plugins/fset/fset-config.h index 03608674c..24ea3840b 100644 --- a/src/plugins/fset/fset-config.h +++ b/src/plugins/fset/fset-config.h @@ -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];