1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 12:56:37 +02:00

fset: add allowed values for integers in help bar, rename option fset.color.help_string_values to fset.color.help_values

This commit is contained in:
Sébastien Helleu
2017-06-09 22:04:30 +02:00
parent 986ccff885
commit 6bbc2f3f4c
3 changed files with 44 additions and 15 deletions
+39 -10
View File
@@ -117,35 +117,64 @@ fset_bar_item_fset_cb (const void *pointer, void *data,
weechat_string_dyn_concat (default_and_values, FSET_OPTION_VALUE_NULL);
}
if (ptr_fset_option->string_values && ptr_fset_option->string_values[0])
if ((ptr_fset_option->string_values && ptr_fset_option->string_values[0])
|| (ptr_fset_option->type == FSET_OPTION_TYPE_INTEGER))
{
ptr_option = weechat_config_get (ptr_fset_option->name);
if (ptr_option)
{
ptr_string_values = weechat_config_option_get_pointer (
ptr_option, "string_values");
if (ptr_string_values)
ptr_string_values = NULL;
if (ptr_fset_option->string_values && ptr_fset_option->string_values[0])
{
ptr_string_values = weechat_config_option_get_pointer (
ptr_option, "string_values");
}
if (ptr_string_values
|| (ptr_fset_option->type == FSET_OPTION_TYPE_INTEGER))
{
weechat_string_dyn_concat (default_and_values,
weechat_color ("bar_fg"));
weechat_string_dyn_concat (default_and_values, ", ");
weechat_string_dyn_concat (default_and_values, _("values:"));
weechat_string_dyn_concat (default_and_values, " ");
for (i = 0; ptr_string_values[i]; i++)
if (ptr_string_values)
{
if (i > 0)
for (i = 0; ptr_string_values[i]; i++)
{
if (i > 0)
{
weechat_string_dyn_concat (default_and_values,
weechat_color ("bar_fg"));
weechat_string_dyn_concat (default_and_values, ", ");
}
weechat_string_dyn_concat (
default_and_values,
weechat_color (
weechat_config_string (
fset_config_color_help_values)));
weechat_string_dyn_concat (default_and_values,
weechat_color ("bar_fg"));
weechat_string_dyn_concat (default_and_values, ", ");
ptr_string_values[i]);
}
}
else
{
weechat_string_dyn_concat (
default_and_values,
weechat_color (
weechat_config_string (
fset_config_color_help_string_values)));
fset_config_color_help_values)));
weechat_string_dyn_concat (default_and_values,
ptr_string_values[i]);
ptr_fset_option->min);
weechat_string_dyn_concat (default_and_values,
weechat_color ("bar_fg"));
weechat_string_dyn_concat (default_and_values, " ... ");
weechat_string_dyn_concat (
default_and_values,
weechat_color (
weechat_config_string (
fset_config_color_help_values)));
weechat_string_dyn_concat (default_and_values,
ptr_fset_option->max);
}
}
}
+4 -4
View File
@@ -61,7 +61,7 @@ struct t_config_option *fset_config_color_help_default_value;
struct t_config_option *fset_config_color_help_description;
struct t_config_option *fset_config_color_help_name;
struct t_config_option *fset_config_color_help_quotes;
struct t_config_option *fset_config_color_help_string_values;
struct t_config_option *fset_config_color_help_values;
struct t_config_option *fset_config_color_marked[2];
struct t_config_option *fset_config_color_max[2];
struct t_config_option *fset_config_color_min[2];
@@ -539,10 +539,10 @@ fset_config_init ()
NULL, NULL, NULL,
&fset_config_change_color_cb, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_help_string_values = weechat_config_new_option (
fset_config_color_help_values = weechat_config_new_option (
fset_config_file, ptr_section,
"help_string_values", "color",
N_("color for string values"),
"help_values", "color",
N_("color for allowed values"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color_cb, NULL, NULL,
+1 -1
View File
@@ -47,7 +47,7 @@ extern struct t_config_option *fset_config_color_help_default_value;
extern struct t_config_option *fset_config_color_help_description;
extern struct t_config_option *fset_config_color_help_name;
extern struct t_config_option *fset_config_color_help_quotes;
extern struct t_config_option *fset_config_color_help_string_values;
extern struct t_config_option *fset_config_color_help_values;
extern struct t_config_option *fset_config_color_marked[2];
extern struct t_config_option *fset_config_color_max[2];
extern struct t_config_option *fset_config_color_min[2];