From 5acf4ba5745759497b63c35ff927438e8faa7ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 17 Jun 2017 14:55:16 +0200 Subject: fset: only mark/unmark matching options with "m:" and "u:", do not toggle mark on non-matching options --- src/plugins/fset/fset-option.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index 6e31e93a3..ea2695cf4 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -1200,7 +1200,7 @@ fset_option_toggle_mark (struct t_fset_option *fset_option, void fset_option_mark_options_matching_filter (const char *filter, int mark) { - int num_options, i, mark_old; + int num_options, i, mark_old, matching; struct t_fset_option *ptr_fset_option; num_options = weechat_arraylist_size (fset_options); @@ -1210,12 +1210,20 @@ fset_option_mark_options_matching_filter (const char *filter, int mark) 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; + matching = fset_option_match_filter (ptr_fset_option, filter); + if (matching) + { + if (!mark_old && mark) + { + ptr_fset_option->marked = 1; + fset_option_count_marked++; + } + else if (mark_old && !mark) + { + ptr_fset_option->marked = 0; + fset_option_count_marked--; + } + } } } fset_buffer_refresh (0); -- cgit v1.2.3