1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

fset: add options fset.color.quotes_changed and fset.color.quotes_changed_selected

This commit is contained in:
Sébastien Helleu
2017-06-01 21:53:14 +02:00
parent 7336c93270
commit 7a08099d18
3 changed files with 39 additions and 11 deletions
+16 -7
View File
@@ -114,7 +114,7 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
int selected_line;
int default_value_undef, value_undef, value_changed;
int type, marked, add_quotes, add_quotes_parent;
struct t_config_option *ptr_option_color_value;
struct t_config_option *ptr_option_color_value, *ptr_option_color_quotes;
selected_line = (y == fset_buffer_selected_line) ? 1 : 0;
@@ -250,22 +250,31 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
fset_option, "value");
add_quotes = (ptr_field && (fset_option->type == FSET_OPTION_TYPE_STRING)) ? 1 : 0;
if (value_undef)
{
ptr_option_color_value = fset_config_color_value_undef[selected_line];
ptr_option_color_quotes = fset_config_color_quotes[selected_line];
}
else if (value_changed)
{
ptr_option_color_value = fset_config_color_value_changed[selected_line];
ptr_option_color_quotes = fset_config_color_quotes_changed[selected_line];
}
else
{
ptr_option_color_value = fset_config_color_value[selected_line];
ptr_option_color_quotes = fset_config_color_quotes[selected_line];
}
snprintf (str_field, sizeof (str_field),
"%s", (ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL);
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
"__value", str_field);
snprintf (str_field, sizeof (str_field),
"%s%s%s%s%s%s",
(add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
(add_quotes) ? weechat_color (weechat_config_string (ptr_option_color_quotes)) : "",
(add_quotes) ? "\"" : "",
weechat_color (weechat_config_string (ptr_option_color_value)),
(ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL,
(add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
(add_quotes) ? weechat_color (weechat_config_string (ptr_option_color_quotes)) : "",
(add_quotes) ? "\"" : "");
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
"_value", str_field);
@@ -287,11 +296,11 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
"__value2", str_field);
snprintf (str_field, sizeof (str_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) ? weechat_color (weechat_config_string (ptr_option_color_quotes)) : "",
(add_quotes) ? "\"" : "",
weechat_color (weechat_config_string (ptr_option_color_value)),
(ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL,
(add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
(add_quotes) ? weechat_color (weechat_config_string (ptr_option_color_quotes)) : "",
(add_quotes) ? "\"" : "",
weechat_color ("default"),
(add_quotes_parent) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
@@ -315,11 +324,11 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
"__value2", str_field);
snprintf (str_field, sizeof (str_field),
"%s%s%s%s%s%s",
(add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
(add_quotes) ? weechat_color (weechat_config_string (ptr_option_color_quotes)) : "",
(add_quotes) ? "\"" : "",
weechat_color (weechat_config_string (ptr_option_color_value)),
(ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL,
(add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "",
(add_quotes) ? weechat_color (weechat_config_string (ptr_option_color_quotes)) : "",
(add_quotes) ? "\"" : "");
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
"_value2", str_field);
+22 -4
View File
@@ -63,6 +63,7 @@ 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_quotes_changed[2];
struct t_config_option *fset_config_color_string_values[2];
struct t_config_option *fset_config_color_type[2];
struct t_config_option *fset_config_color_unmarked[2];
@@ -517,6 +518,23 @@ fset_config_init ()
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_quotes_changed[0] = weechat_config_new_option (
fset_config_file, ptr_section,
"quotes_changed", "color",
N_("color for quotes around string values which are changed"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_quotes_changed[1] = weechat_config_new_option (
fset_config_file, ptr_section,
"quotes_changed_selected", "color",
N_("color for quotes around string values which are changed "
"on the selected line"),
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_string_values[0] = weechat_config_new_option (
fset_config_file, ptr_section,
"string_values", "color",
@@ -537,7 +555,7 @@ fset_config_init ()
fset_config_file, ptr_section,
"type", "color",
N_("color for type"),
NULL, 0, 0, "brown", NULL, 0,
NULL, 0, 0, "green", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
@@ -545,7 +563,7 @@ fset_config_init ()
fset_config_file, ptr_section,
"type_selected", "color",
N_("color for type on the selected line"),
NULL, 0, 0, "yellow", NULL, 0,
NULL, 0, 0, "lightgreen", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
@@ -585,7 +603,7 @@ fset_config_init ()
fset_config_file, ptr_section,
"value_changed", "color",
N_("color for value changed (different from default)"),
NULL, 0, 0, "green", NULL, 0,
NULL, 0, 0, "brown", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
@@ -594,7 +612,7 @@ fset_config_init ()
"value_changed_selected", "color",
N_("color for value changed (different from default) on the selected "
"line"),
NULL, 0, 0, "lightgreen", NULL, 0,
NULL, 0, 0, "yellow", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
+1
View File
@@ -50,6 +50,7 @@ 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_quotes_changed[2];
extern struct t_config_option *fset_config_color_string_values[2];
extern struct t_config_option *fset_config_color_type[2];
extern struct t_config_option *fset_config_color_unmarked[2];