summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/fset/fset-buffer.c16
-rw-r--r--src/plugins/fset/fset-command.c4
-rw-r--r--src/plugins/fset/fset-config.c15
-rw-r--r--src/plugins/fset/fset-config.h2
-rw-r--r--src/plugins/fset/fset-option.c14
-rw-r--r--src/plugins/fset/fset-option.h2
6 files changed, 32 insertions, 21 deletions
diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c
index 9b2e222e2..12db4265f 100644
--- a/src/plugins/fset/fset-buffer.c
+++ b/src/plugins/fset/fset-buffer.c
@@ -103,7 +103,7 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
char *line, str_field[4096];
const char *ptr_field, *ptr_parent_value;
int selected_line;
- int default_value_undef, value_undef, value_diff;
+ int default_value_undef, value_undef, value_changed;
int add_quotes, add_quotes_parent;
struct t_config_option *ptr_option_color_value;
@@ -111,7 +111,7 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
default_value_undef = (fset_option->default_value == NULL) ? 1 : 0;
value_undef = (fset_option->value == NULL) ? 1 : 0;
- value_diff = (fset_option_value_different_from_default (fset_option)) ? 1 : 0;
+ value_changed = (fset_option_value_is_changed (fset_option)) ? 1 : 0;
/* set pointers */
weechat_hashtable_set (fset_buffer_hashtable_pointers,
@@ -197,8 +197,8 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
add_quotes = (ptr_field && (strcmp (fset_option->type, "string") == 0)) ? 1 : 0;
if (value_undef)
ptr_option_color_value = fset_config_color_value_undef[selected_line];
- else if (value_diff)
- ptr_option_color_value = fset_config_color_value_diff[selected_line];
+ else if (value_changed)
+ ptr_option_color_value = fset_config_color_value_changed[selected_line];
else
ptr_option_color_value = fset_config_color_value[selected_line];
snprintf (str_field, sizeof (str_field),
@@ -375,8 +375,14 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option)
/* set other variables depending on the value */
weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
+ "default_value_undef",
+ (default_value_undef) ? "1" : "0");
+ weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
"value_undef",
- (fset_option->value == NULL) ? "1" : "0");
+ (value_undef) ? "1" : "0");
+ weechat_hashtable_set (fset_buffer_hashtable_extra_vars,
+ "value_changed",
+ (value_changed) ? "1" : "0");
/* build string for line */
line = weechat_string_eval_expression (
diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c
index 05fda0838..eea8263e3 100644
--- a/src/plugins/fset/fset-command.c
+++ b/src/plugins/fset/fset-command.c
@@ -434,8 +434,12 @@ fset_command_init ()
" - ${parent_name}: parent option name\n"
" - ${type}: option type\n"
" - ${default_value}: option default value\n"
+ " - ${default_value_undef}: \"1\" if default value is null, "
+ "otherwise \"0\"\n"
" - ${value}: option value\n"
" - ${value_undef}: \"1\" if value is null, otherwise \"0\"\n"
+ " - ${value_changed}: \"1\" if value is different from default "
+ "value, otherwise \"0\"\n"
" - ${value2}: option value, with inherited value if null\n"
" - ${parent_value}: parent option value\n"
" - ${min}: min value\n"
diff --git a/src/plugins/fset/fset-config.c b/src/plugins/fset/fset-config.c
index adde59df8..ccc76b607 100644
--- a/src/plugins/fset/fset-config.c
+++ b/src/plugins/fset/fset-config.c
@@ -61,7 +61,7 @@ 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];
struct t_config_option *fset_config_color_value[2];
-struct t_config_option *fset_config_color_value_diff[2];
+struct t_config_option *fset_config_color_value_changed[2];
struct t_config_option *fset_config_color_value_undef[2];
char *fset_config_eval_format_option_current = NULL;
@@ -495,18 +495,19 @@ fset_config_init ()
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
- fset_config_color_value_diff[0] = weechat_config_new_option (
+ fset_config_color_value_changed[0] = weechat_config_new_option (
fset_config_file, ptr_section,
- "value_diff", "color",
- N_("color for value different from default"),
+ "value_changed", "color",
+ N_("color for value changed (different from default)"),
NULL, 0, 0, "green", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
NULL, NULL, NULL);
- fset_config_color_value_diff[1] = weechat_config_new_option (
+ fset_config_color_value_changed[1] = weechat_config_new_option (
fset_config_file, ptr_section,
- "value_diff_selected", "color",
- N_("color for value different from default on the selected line"),
+ "value_changed_selected", "color",
+ N_("color for value changed (different from default) on the selected "
+ "line"),
NULL, 0, 0, "lightgreen", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color, NULL, NULL,
diff --git a/src/plugins/fset/fset-config.h b/src/plugins/fset/fset-config.h
index 2ecc98e37..86bdfd67c 100644
--- a/src/plugins/fset/fset-config.h
+++ b/src/plugins/fset/fset-config.h
@@ -48,7 +48,7 @@ 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];
extern struct t_config_option *fset_config_color_value[2];
-extern struct t_config_option *fset_config_color_value_diff[2];
+extern struct t_config_option *fset_config_color_value_changed[2];
extern struct t_config_option *fset_config_color_value_undef[2];
extern char *fset_config_eval_format_option_current;
diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c
index fcccd8dcd..a201d3e6f 100644
--- a/src/plugins/fset/fset-option.c
+++ b/src/plugins/fset/fset-option.c
@@ -99,15 +99,15 @@ fset_option_search_by_name (const char *name, int *line)
}
/*
- * Checks if the option value is different from the default value.
+ * Checks if the option value is changed (different from the default value).
*
* Returns:
- * 1: value is different from default value
+ * 1: value has been changed
* 0: value is the same as default value
*/
int
-fset_option_value_different_from_default (struct t_fset_option *fset_option)
+fset_option_value_is_changed (struct t_fset_option *fset_option)
{
if (!fset_option->value && !fset_option->default_value)
return 0;
@@ -223,7 +223,7 @@ fset_option_match_filters (const char *config_name, const char *section_name,
else if (strncmp (fset_option_filter, "d==", 3) == 0)
{
/* filter by modified values, exact value */
- if (!fset_option_value_different_from_default (fset_option))
+ if (!fset_option_value_is_changed (fset_option))
return 0;
return (weechat_strcasecmp (
(fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL,
@@ -232,7 +232,7 @@ fset_option_match_filters (const char *config_name, const char *section_name,
else if (strncmp (fset_option_filter, "d=", 2) == 0)
{
/* filter by modified values, value */
- if (!fset_option_value_different_from_default (fset_option))
+ if (!fset_option_value_is_changed (fset_option))
return 0;
return (fset_option_string_match (
(fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL,
@@ -241,7 +241,7 @@ fset_option_match_filters (const char *config_name, const char *section_name,
else if (strncmp (fset_option_filter, "d:", 2) == 0)
{
/* filter by modified values */
- if (!fset_option_value_different_from_default (fset_option))
+ if (!fset_option_value_is_changed (fset_option))
return 0;
return fset_option_string_match (fset_option->name,
fset_option_filter + 2) ? 1 : 0;
@@ -249,7 +249,7 @@ fset_option_match_filters (const char *config_name, const char *section_name,
else if (strcmp (fset_option_filter, "d") == 0)
{
/* filter by modified values */
- return (fset_option_value_different_from_default (fset_option)) ? 1 : 0;
+ return (fset_option_value_is_changed (fset_option)) ? 1 : 0;
}
else if (strncmp (fset_option_filter, "==", 2) == 0)
{
diff --git a/src/plugins/fset/fset-option.h b/src/plugins/fset/fset-option.h
index c08e240fe..d1b7551e6 100644
--- a/src/plugins/fset/fset-option.h
+++ b/src/plugins/fset/fset-option.h
@@ -45,7 +45,7 @@ extern char *fset_option_filter;
extern int fset_option_valid (struct t_fset_option *option);
extern struct t_fset_option *fset_option_search_by_name (const char *name,
int *line);
-extern int fset_option_value_different_from_default (struct t_fset_option *option);
+extern int fset_option_value_is_changed (struct t_fset_option *option);
extern void fset_option_free (struct t_fset_option *fset_option);
extern struct t_arraylist *fset_option_get_arraylist_options ();
extern struct t_hashtable *fset_option_get_hashtable_max_length_field ();