1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

fset: add options for colors in buffer's title

New options:
- fset.color.title_count_options
- fset.color.title_current_option
- fset.color.title_filter
- fset.color.title_marked_options
- fset.color.title_sort
This commit is contained in:
Sébastien Helleu
2017-06-05 21:13:09 +02:00
parent 476f6ae7bb
commit 690ef1e309
4 changed files with 90 additions and 12 deletions
+22 -12
View File
@@ -54,15 +54,17 @@ fset_buffer_set_title ()
if (fset_option_count_marked > 0)
{
snprintf (str_marked, sizeof (str_marked),
" (*: %d)",
fset_option_count_marked);
" (*: %s%d%s)",
weechat_color (weechat_config_string (fset_config_color_title_marked_options)),
fset_option_count_marked,
weechat_color ("bar_fg"));
}
num_options = weechat_arraylist_size (fset_options);
snprintf (str_title, sizeof (str_title),
_("Filter: %s | %d/%d%s | "
"Sort: %s | "
_("Filter: %s%s%s | %s%d%s/%s%d%s%s | "
"Sort: %s%s%s | "
"Key(input): "
"alt+space=toggle boolean, "
"alt+'-'(-)=subtract 1, "
@@ -70,19 +72,27 @@ fset_buffer_set_title ()
"alt+f,alt+r(r)=reset, "
"alf+f,alt+u(u)=unset, "
"alt+enter(s)=set, "
"alt+f,alt+a(a)=append "
"alt+','=mark/unmark "
"shift+down=mark/move down "
"shift+up=mark/move up "
"($)=refresh "
"($$)=unmark/refresh "
"alt+v(v)=toggle help bar "
"alt+f,alt+a(a)=append, "
"alt+','=mark/unmark, "
"shift+down=mark and move down, "
"shift+up=mark and move up, "
"($)=refresh, "
"($$)=unmark/refresh, "
"alt+v(v)=toggle help bar, "
"(q)=close buffer"),
weechat_color (weechat_config_string (fset_config_color_title_filter)),
(fset_option_filter) ? fset_option_filter : "*",
weechat_color ("bar_fg"),
weechat_color (weechat_config_string (fset_config_color_title_current_option)),
(num_options > 0) ? fset_buffer_selected_line + 1 : 0,
weechat_color ("bar_fg"),
weechat_color (weechat_config_string (fset_config_color_title_count_options)),
num_options,
weechat_color ("bar_fg"),
str_marked,
weechat_config_string (fset_config_look_sort));
weechat_color (weechat_config_string (fset_config_color_title_sort)),
weechat_config_string (fset_config_look_sort),
weechat_color ("bar_fg"));
weechat_buffer_set (fset_buffer, "title", str_title);
}
+1
View File
@@ -27,6 +27,7 @@ struct t_fset_option;
extern struct t_gui_buffer *fset_buffer;
extern int fset_buffer_selected_line;
extern void fset_buffer_set_title ();
extern void fset_buffer_display_line (int y,
struct t_fset_option *fset_option);
extern void fset_buffer_refresh (int clear);
+62
View File
@@ -75,6 +75,11 @@ struct t_config_option *fset_config_color_quotes_changed[2];
struct t_config_option *fset_config_color_section[2];
struct t_config_option *fset_config_color_section_changed[2];
struct t_config_option *fset_config_color_string_values[2];
struct t_config_option *fset_config_color_title_count_options;
struct t_config_option *fset_config_color_title_current_option;
struct t_config_option *fset_config_color_title_filter;
struct t_config_option *fset_config_color_title_marked_options;
struct t_config_option *fset_config_color_title_sort;
struct t_config_option *fset_config_color_type[2];
struct t_config_option *fset_config_color_unmarked[2];
struct t_config_option *fset_config_color_value[2];
@@ -235,6 +240,22 @@ fset_config_change_color_cb (const void *pointer, void *data,
fset_buffer_refresh (0);
}
/*
* Callback for changes on title color options.
*/
void
fset_config_change_title_color_cb (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
fset_buffer_set_title ();
}
/*
* Initializes fset configuration file.
*
@@ -739,6 +760,47 @@ fset_config_init ()
NULL, NULL, NULL,
&fset_config_change_color_cb, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_title_count_options = weechat_config_new_option (
fset_config_file, ptr_section,
"title_count_options", "color",
N_("color for the count of options found with the current filter "
"in title of buffer"),
NULL, 0, 0, "cyan", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_title_color_cb, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_title_current_option = weechat_config_new_option (
fset_config_file, ptr_section,
"title_current_option", "color",
N_("color for current option number in title of buffer"),
NULL, 0, 0, "lightcyan", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_title_color_cb, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_title_filter = weechat_config_new_option (
fset_config_file, ptr_section,
"title_filter", "color",
N_("color for filter in title of buffer"),
NULL, 0, 0, "yellow", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_title_color_cb, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_title_marked_options = weechat_config_new_option (
fset_config_file, ptr_section,
"title_marked_options", "color",
N_("color for number of marked options in title of buffer"),
NULL, 0, 0, "lightgreen", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_title_color_cb, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_title_sort = weechat_config_new_option (
fset_config_file, ptr_section,
"title_sort", "color",
N_("color for sort in title of buffer"),
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_title_color_cb, NULL, NULL,
NULL, NULL, NULL);
fset_config_color_type[0] = weechat_config_new_option (
fset_config_file, ptr_section,
"type", "color",
+5
View File
@@ -61,6 +61,11 @@ extern struct t_config_option *fset_config_color_quotes_changed[2];
extern struct t_config_option *fset_config_color_section[2];
extern struct t_config_option *fset_config_color_section_changed[2];
extern struct t_config_option *fset_config_color_string_values[2];
extern struct t_config_option *fset_config_color_title_count_options;
extern struct t_config_option *fset_config_color_title_current_option;
extern struct t_config_option *fset_config_color_title_filter;
extern struct t_config_option *fset_config_color_title_marked_options;
extern struct t_config_option *fset_config_color_title_sort;
extern struct t_config_option *fset_config_color_type[2];
extern struct t_config_option *fset_config_color_unmarked[2];
extern struct t_config_option *fset_config_color_value[2];