diff options
Diffstat (limited to 'src/plugins/fset/fset-option.c')
-rw-r--r-- | src/plugins/fset/fset-option.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index acaa2084f..6e31e93a3 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -1179,11 +1179,8 @@ fset_option_set (struct t_fset_option *fset_option, void fset_option_toggle_mark (struct t_fset_option *fset_option, - struct t_config_option *option, - int value) + struct t_config_option *option) { - int num_options, line; - /* make C compiler happy */ (void) option; @@ -1192,24 +1189,18 @@ fset_option_toggle_mark (struct t_fset_option *fset_option, fset_option->marked ^= 1; fset_option_count_marked += (fset_option->marked) ? 1 : -1; - num_options = weechat_arraylist_size (fset_options); - line = fset_buffer_selected_line + value; - if (line < 0) - line = 0; - else if (line >= num_options) - line = num_options - 1; - fset_buffer_set_current_line (line); - fset_buffer_check_line_outside_window (); + + fset_buffer_refresh (0); } /* - * Unmarks all options. + * Mark/unmark options matching a filter. */ void -fset_option_unmark_all () +fset_option_mark_options_matching_filter (const char *filter, int mark) { - int num_options, i; + int num_options, i, mark_old; struct t_fset_option *ptr_fset_option; num_options = weechat_arraylist_size (fset_options); @@ -1217,20 +1208,27 @@ fset_option_unmark_all () { ptr_fset_option = weechat_arraylist_get (fset_options, i); if (ptr_fset_option) - ptr_fset_option->marked = 0; + { + mark_old = ptr_fset_option->marked; + if (fset_option_match_filter (ptr_fset_option, filter)) + ptr_fset_option->marked = mark; + else + ptr_fset_option->marked = mark ^ 1; + if (mark_old != ptr_fset_option->marked) + fset_option_count_marked += (ptr_fset_option->marked) ? 1 : -1; + } } - fset_option_count_marked = 0; fset_buffer_refresh (0); } /* - * Mark/unmark options matching a filter. + * Unmarks all options. */ void -fset_option_mark_options_matching_filter (const char *filter, int mark) +fset_option_unmark_all () { - int num_options, i, mark_old; + int num_options, i; struct t_fset_option *ptr_fset_option; num_options = weechat_arraylist_size (fset_options); @@ -1238,16 +1236,9 @@ fset_option_mark_options_matching_filter (const char *filter, int mark) { ptr_fset_option = weechat_arraylist_get (fset_options, i); if (ptr_fset_option) - { - mark_old = ptr_fset_option->marked; - if (fset_option_match_filter (ptr_fset_option, filter)) - ptr_fset_option->marked = mark; - else - ptr_fset_option->marked = mark ^ 1; - if (mark_old != ptr_fset_option->marked) - fset_option_count_marked += (ptr_fset_option->marked) ? 1 : -1; - } + ptr_fset_option->marked = 0; } + fset_option_count_marked = 0; fset_buffer_refresh (0); } |