diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-05-28 14:13:15 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-06-25 16:35:27 +0200 |
commit | 7afe5ca4de543a48b028cb6bebf86521afc5fcfe (patch) | |
tree | 032953e14bc6c0500259bc1149e55c5fe4f89b15 /src | |
parent | f4169608d1ac49fbdcb38a70d7a0ee05e2028b35 (diff) | |
download | weechat-7afe5ca4de543a48b028cb6bebf86521afc5fcfe.zip |
fset: add evaluated variables prefixed by one or two underscores
One underscore: value not padded with spaces on the right.
Two unerscores: raw value (no color, no padding).
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/fset/fset-buffer.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c index 6161fa2a2..727b6a86b 100644 --- a/src/plugins/fset/fset-buffer.c +++ b/src/plugins/fset/fset-buffer.c @@ -95,10 +95,15 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) /* name */ ptr_field = weechat_hdata_string (fset_hdata_fset_option, fset_option, "name"); + snprintf (str_field, sizeof (str_field), "%s", ptr_field); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "__name", str_field); snprintf (str_field, sizeof (str_field), "%s%s", weechat_color (weechat_config_string (fset_config_color_name[selected_line])), ptr_field); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "_name", str_field); fset_buffer_fills_field (str_field, sizeof (str_field), "name", 64); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "name", str_field); @@ -106,10 +111,15 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) /* parent_name */ ptr_field = weechat_hdata_string (fset_hdata_fset_option, fset_option, "parent_name"); + snprintf (str_field, sizeof (str_field), "%s", ptr_field); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "__parent_name", str_field); snprintf (str_field, sizeof (str_field), "%s%s", weechat_color (weechat_config_string (fset_config_color_parent_name[selected_line])), ptr_field); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "_parent_name", str_field); fset_buffer_fills_field (str_field, sizeof (str_field), "parent_name", 64); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "parent_name", str_field); @@ -117,10 +127,15 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) /* type */ ptr_field = weechat_hdata_string (fset_hdata_fset_option, fset_option, "type"); + snprintf (str_field, sizeof (str_field), "%s", ptr_field); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "__type", str_field); snprintf (str_field, sizeof (str_field), "%s%s", weechat_color (weechat_config_string (fset_config_color_type[selected_line])), ptr_field); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "_type", str_field); fset_buffer_fills_field (str_field, sizeof (str_field), "type", 8); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "type", str_field); @@ -134,6 +149,10 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) else ptr_option_color_value = fset_config_color_value[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, + "__default_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) ? "\"" : "", @@ -141,6 +160,8 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) (ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL, (add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "", (add_quotes) ? "\"" : ""); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "_default_value", str_field); fset_buffer_fills_field (str_field, sizeof (str_field), "default_value", 16); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "default_value", str_field); @@ -156,6 +177,10 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) else ptr_option_color_value = fset_config_color_value[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) ? "\"" : "", @@ -163,6 +188,8 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) (ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL, (add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "", (add_quotes) ? "\"" : ""); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "_value", str_field); fset_buffer_fills_field (str_field, sizeof (str_field), "value", 16); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "value", str_field); @@ -174,6 +201,12 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) { add_quotes_parent = (ptr_parent_value && (strcmp (fset_option->type, "string") == 0)) ? 1 : 0; snprintf (str_field, sizeof (str_field), + "%s -> %s", + (ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL, + (ptr_parent_value) ? ptr_parent_value : FSET_OPTION_VALUE_NULL); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "__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) ? "\"" : "", @@ -188,6 +221,8 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) (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, + "_value2", str_field); fset_buffer_fills_field (str_field, sizeof (str_field), "value2", 32); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "value2", str_field); @@ -195,6 +230,11 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) else { snprintf (str_field, sizeof (str_field), + "%s", + (ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "__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) ? "\"" : "", @@ -202,6 +242,8 @@ fset_buffer_display_line (int y, struct t_fset_option *fset_option) (ptr_field) ? ptr_field : FSET_OPTION_VALUE_NULL, (add_quotes) ? weechat_color (weechat_config_string (fset_config_color_quotes[selected_line])) : "", (add_quotes) ? "\"" : ""); + weechat_hashtable_set (fset_buffer_hashtable_extra_vars, + "_value2", str_field); fset_buffer_fills_field (str_field, sizeof (str_field), "value2", 32); weechat_hashtable_set (fset_buffer_hashtable_extra_vars, "value2", str_field); |