diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/fset/fset-buffer.c | 103 | ||||
-rw-r--r-- | src/plugins/fset/fset-config.c | 19 | ||||
-rw-r--r-- | src/plugins/fset/fset-config.h | 1 |
3 files changed, 105 insertions, 18 deletions
diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c index f49bfd317..edeb7912d 100644 --- a/src/plugins/fset/fset-buffer.c +++ b/src/plugins/fset/fset-buffer.c @@ -167,7 +167,8 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option) { char *line, str_color_line[128], **lines; char *str_field, *str_field2; - char str_color_value[128], str_color_quotes[128], str_number[64]; + char str_color_value[128], str_color_quotes[128], str_color_name[512]; + char str_number[64]; int length, length_field, selected_line, y, y_max, i, num_lines; int default_value_undef, value_undef, value_changed; int add_quotes, add_quotes_parent, format_number; @@ -389,18 +390,37 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option) (default_value_undef) ? fset_config_color_value_undef[selected_line] : fset_config_color_default_value[selected_line]))); + str_color_name[0] = '\0'; + if ((fset_option->type == FSET_OPTION_TYPE_COLOR) + && weechat_config_boolean (fset_config_look_use_color_value) + && fset_option->default_value) + { + snprintf (str_color_name, sizeof (str_color_name), + " %s(%s%s%s)", + weechat_color ( + weechat_config_string ( + fset_config_color_quotes[selected_line])), + weechat_color ( + weechat_config_string ( + fset_config_color_color_name[selected_line])), + fset_option->default_value, + weechat_color ( + weechat_config_string ( + fset_config_color_quotes[selected_line]))); + } snprintf (str_field, length_field, "%s", (fset_option->default_value) ? fset_option->default_value : FSET_OPTION_VALUE_NULL); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "__default_value", str_field); snprintf (str_field, length_field, - "%s%s%s%s%s%s", + "%s%s%s%s%s%s%s", (add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "", (add_quotes) ? "\"" : "", str_color_value, (fset_option->default_value) ? fset_option->default_value : FSET_OPTION_VALUE_NULL, (add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "", - (add_quotes) ? "\"" : ""); + (add_quotes) ? "\"" : "", + str_color_name); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "_default_value", str_field); fset_buffer_fills_field (str_field, str_field2, length_field, @@ -418,6 +438,11 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option) snprintf (str_color_value, sizeof (str_color_value), "%s", weechat_color (fset_option->value)); + snprintf (str_color_quotes, sizeof (str_color_quotes), + "%s", + weechat_color ( + weechat_config_string ( + fset_config_color_quotes[selected_line]))); } else if (value_undef) { @@ -458,18 +483,36 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option) weechat_config_string ( fset_config_color_quotes[selected_line]))); } + str_color_name[0] = '\0'; + if ((fset_option->type == FSET_OPTION_TYPE_COLOR) + && weechat_config_boolean (fset_config_look_use_color_value)) + { + snprintf (str_color_name, sizeof (str_color_name), + " %s(%s%s%s)", + weechat_color ( + weechat_config_string ( + fset_config_color_quotes[selected_line])), + weechat_color ( + weechat_config_string ( + fset_config_color_color_name[selected_line])), + fset_option->value, + weechat_color ( + weechat_config_string ( + fset_config_color_quotes[selected_line]))); + } snprintf (str_field, length_field, "%s", (fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "__value", str_field); snprintf (str_field, length_field, - "%s%s%s%s%s%s", + "%s%s%s%s%s%s%s", (add_quotes) ? str_color_quotes : "", (add_quotes) ? "\"" : "", str_color_value, (fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL, (add_quotes) ? str_color_quotes : "", - (add_quotes) ? "\"" : ""); + (add_quotes) ? "\"" : "", + str_color_name); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "_value", str_field); fset_buffer_fills_field (str_field, str_field2, length_field, @@ -490,7 +533,7 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option) weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "__value2", str_field); snprintf (str_field, length_field, - "%s%s%s%s%s%s%s -> %s%s%s%s%s%s", + "%s%s%s%s%s%s%s -> %s%s%s%s%s%s%s", (add_quotes) ? str_color_quotes : "", (add_quotes) ? "\"" : "", str_color_value, @@ -503,7 +546,8 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option) weechat_color (weechat_config_string (fset_config_color_parent_value[selected_line])), (fset_option->parent_value) ? fset_option->parent_value : FSET_OPTION_VALUE_NULL, (add_quotes_parent) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "", - (add_quotes_parent) ? "\"" : ""); + (add_quotes_parent) ? "\"" : "", + str_color_name); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "_value2", str_field); fset_buffer_fills_field (str_field, str_field2, length_field, @@ -521,13 +565,14 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option) weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "__value2", str_field); snprintf (str_field, length_field, - "%s%s%s%s%s%s", - (add_quotes) ? str_color_quotes : "", - (add_quotes) ? "\"" : "", - str_color_value, - (fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL, - (add_quotes) ? str_color_quotes : "", - (add_quotes) ? "\"" : ""); + "%s%s%s%s%s%s%s", + (add_quotes) ? str_color_quotes : "", + (add_quotes) ? "\"" : "", + str_color_value, + (fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL, + (add_quotes) ? str_color_quotes : "", + (add_quotes) ? "\"" : "", + str_color_name); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "_value2", str_field); fset_buffer_fills_field (str_field, str_field2, length_field, @@ -831,6 +876,7 @@ fset_buffer_display_option_predefined_format (struct t_fset_option *fset_option) int add_quotes, add_quotes_parent, length_value; char str_marked[128], str_name[4096], str_type[128], *str_value; char str_color_line[128], str_color_value[128], str_color_quotes[128]; + char str_color_name[512]; if (!fset_option) return -1; @@ -883,6 +929,11 @@ fset_buffer_display_option_predefined_format (struct t_fset_option *fset_option) snprintf (str_color_value, sizeof (str_color_value), "%s", weechat_color (fset_option->value)); + snprintf (str_color_quotes, sizeof (str_color_quotes), + "%s", + weechat_color ( + weechat_config_string ( + fset_config_color_quotes[selected_line]))); } else if (value_undef) { @@ -923,6 +974,20 @@ fset_buffer_display_option_predefined_format (struct t_fset_option *fset_option) weechat_config_string ( fset_config_color_quotes[selected_line]))); } + str_color_name[0] = '\0'; + if ((fset_option->type == FSET_OPTION_TYPE_COLOR) + && weechat_config_boolean (fset_config_look_use_color_value) + && fset_option->value) + { + snprintf (str_color_name, sizeof (str_color_name), + " %s(%s%s%s)", + str_color_quotes, + weechat_color ( + weechat_config_string ( + fset_config_color_color_name[selected_line])), + fset_option->value, + str_color_quotes); + } length_value = (fset_option->value) ? strlen (fset_option->value) + 256 : 4096; str_value = malloc (length_value); @@ -932,7 +997,7 @@ fset_buffer_display_option_predefined_format (struct t_fset_option *fset_option) { add_quotes_parent = (fset_option->parent_value && (fset_option->type == FSET_OPTION_TYPE_STRING)) ? 1 : 0; snprintf (str_value, length_value, - "%s%s%s%s%s%s%s -> %s%s%s%s%s%s", + "%s%s%s%s%s%s%s -> %s%s%s%s%s%s%s", (add_quotes) ? str_color_quotes : "", (add_quotes) ? "\"" : "", str_color_value, @@ -945,18 +1010,20 @@ fset_buffer_display_option_predefined_format (struct t_fset_option *fset_option) weechat_color (weechat_config_string (fset_config_color_parent_value[selected_line])), (fset_option->parent_value) ? fset_option->parent_value : FSET_OPTION_VALUE_NULL, (add_quotes_parent) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "", - (add_quotes_parent) ? "\"" : ""); + (add_quotes_parent) ? "\"" : "", + str_color_name); } else { snprintf (str_value, length_value, - "%s%s%s%s%s%s", + "%s%s%s%s%s%s%s", (add_quotes) ? str_color_quotes : "", (add_quotes) ? "\"" : "", str_color_value, (fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL, (add_quotes) ? str_color_quotes : "", - (add_quotes) ? "\"" : ""); + (add_quotes) ? "\"" : "", + str_color_name); } } diff --git a/src/plugins/fset/fset-config.c b/src/plugins/fset/fset-config.c index dfb0c5cc0..30bbf47b3 100644 --- a/src/plugins/fset/fset-config.c +++ b/src/plugins/fset/fset-config.c @@ -63,6 +63,7 @@ struct t_config_option *fset_config_format_option[2] = { NULL, NULL }; /* fset config, color section */ +struct t_config_option *fset_config_color_color_name[2] = { NULL, NULL }; struct t_config_option *fset_config_color_default_value[2] = { NULL, NULL }; struct t_config_option *fset_config_color_description[2] = { NULL, NULL }; struct t_config_option *fset_config_color_file[2] = { NULL, NULL }; @@ -602,6 +603,24 @@ fset_config_init () NULL, NULL, NULL); if (fset_config_section_color) { + fset_config_color_color_name[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "color_name", "color", + N_("color for color name when option fset.look.use_color_value is " + "enabled"), + NULL, 0, 0, "246", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_color_name[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "color_name_selected", "color", + N_("color for color name on the selected line when option " + "fset.look.use_color_value is enabled"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); fset_config_color_default_value[0] = weechat_config_new_option ( fset_config_file, fset_config_section_color, "default_value", "color", diff --git a/src/plugins/fset/fset-config.h b/src/plugins/fset/fset-config.h index 75cf3f16a..2579acce1 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_format_export_option; extern struct t_config_option *fset_config_format_export_option_null; extern struct t_config_option *fset_config_format_option[2]; +extern struct t_config_option *fset_config_color_color_name[2]; extern struct t_config_option *fset_config_color_default_value[2]; extern struct t_config_option *fset_config_color_description[2]; extern struct t_config_option *fset_config_color_file[2]; |