diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-05-29 22:32:07 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-06-25 16:35:27 +0200 |
commit | 7df98862d6d41ec45caea5f4b81eac26fa89b2cd (patch) | |
tree | ec56ccc04770d11fb10d519ec10ddb6d43acfcf4 | |
parent | 4c65f2b648312a6fae107ae93716538878f97a92 (diff) | |
download | weechat-7df98862d6d41ec45caea5f4b81eac26fa89b2cd.zip |
fset: add filters "d=" and "d=="
-rw-r--r-- | src/plugins/fset/fset-command.c | 17 | ||||
-rw-r--r-- | src/plugins/fset/fset-option.c | 18 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c index a192369ff..c03f148cc 100644 --- a/src/plugins/fset/fset-command.c +++ b/src/plugins/fset/fset-command.c @@ -284,12 +284,15 @@ fset_command_init () "of option (move the cursor at the end of value)\n" " filter: set a new filter to see only matching options; allowed " "formats are:\n" - " f:xxx show only configuration file \"xxx\"\n" - " s:xxx show only section \"xxx\"\n" - " d: show only changed options\n" - " d:xxx show only changed options with \"xxx\" in name\n" - " =xxx show only options with \"xxx\" in value\n" - " ==xxx show only options with value \"xxx\""), + " * show all options (no filter)\n" + " f:xxx show only configuration file \"xxx\"\n" + " s:xxx show only section \"xxx\"\n" + " d: show only changed options\n" + " d:xxx show only changed options with \"xxx\" in name\n" + " d=xxx show only changed options with \"xxx\" in value\n" + " d==xxx show only changed options with exact value \"xxx\"\n" + " =xxx show only options with \"xxx\" in value\n" + " ==xxx show only options with exact value \"xxx\""), "-bar" " || -refresh" " || -up 1|2|3|4|5" @@ -301,6 +304,6 @@ fset_command_init () " || -unset" " || -set" " || -append" - " || f:|s:|d:|=|==", + " || *|f:|s:|d:|d=|d==|=|==", &fset_command_fset, NULL, NULL); } diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index 534f8dce3..2222a4ab6 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -199,6 +199,24 @@ fset_option_match_filters (const char *config_name, const char *section_name, /* filter by section name */ return (weechat_strcasecmp (section_name, fset_option_filter + 2) == 0) ? 1 : 0; } + else if (strncmp (fset_option_filter, "d==", 3) == 0) + { + /* filter by modified values, exact value */ + if (!fset_option_value_different_from_default (fset_option)) + return 0; + return (weechat_strcasecmp ( + (fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL, + fset_option_filter + 3) == 0) ? 1 : 0; + } + else if (strncmp (fset_option_filter, "d=", 2) == 0) + { + /* filter by modified values, value */ + if (!fset_option_value_different_from_default (fset_option)) + return 0; + return (weechat_strcasestr ( + (fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL, + fset_option_filter + 2)) ? 1 : 0; + } else if (strncmp (fset_option_filter, "d:", 2) == 0) { /* filter by modified values */ |