From fc91ee59c95f77fa6bf8d34ad3e64bc5e570a534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 10 Jun 2023 22:38:54 +0200 Subject: [PATCH] core: add completions "filters_names_disabled" and "filters_names_enabled" They are used in completion of commands `/filter disable` and `/filter enable`. --- ChangeLog.adoc | 1 + po/cs.po | 12 ++++++- po/de.po | 12 ++++++- po/es.po | 12 ++++++- po/fr.po | 10 ++++-- po/hu.po | 10 +++++- po/it.po | 12 ++++++- po/ja.po | 12 ++++++- po/pl.po | 12 ++++++- po/pt.po | 12 ++++++- po/pt_BR.po | 12 ++++++- po/ru.po | 10 +++++- po/sr.po | 12 ++++++- po/tr.po | 12 ++++++- po/weechat.pot | 8 ++++- src/core/wee-command.c | 4 +-- src/core/wee-completion.c | 68 +++++++++++++++++++++++++++++++++++++++ 17 files changed, 214 insertions(+), 17 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 6a8b8aa66..152e45085 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -36,6 +36,7 @@ New features:: * core, plugins: make many identifiers case sensitive (issue #1872, issue #398, bug #32213) * core: add item "mouse_status" in default status bar, change default color to lightgreen * core, trigger: add options weechat.color.chat_status_disabled and weechat.color.chat_status_enabled, remove options trigger.color.trigger and trigger.color.trigger_disabled, add enabled/disabled status color in output of `/filter list` (issue #1820) + * core: add completions "filters_names_disabled" and "filters_names_enabled", used in completion of `/filter disable` and `/filter enable` * api: add function config_set_version (issue #1238) * api: don't split on newline by default in functions `command` and `command_options` when `input_multiline` is set to 0 * api: add optional argument with version in info "version_number" diff --git a/po/cs.po b/po/cs.po index 116212ee0..994f99c10 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -3014,6 +3014,16 @@ msgstr "" msgid "names of filters" msgstr "jména filtrů" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "jména filtrů" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "jména filtrů" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/de.po b/po/de.po index 62d7005b8..585a49fcb 100644 --- a/po/de.po +++ b/po/de.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-06-04 11:12+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -3881,6 +3881,16 @@ msgstr "" msgid "names of filters" msgstr "Liste der Filter" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "Liste der Filter" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "Liste der Filter" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/es.po b/po/es.po index d10374afa..3cfd8f08a 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: Santiago Forero \n" "Language-Team: weechat-dev \n" @@ -3565,6 +3565,16 @@ msgstr "" msgid "names of filters" msgstr "nombre de los filtros" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "nombre de los filtros" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "nombre de los filtros" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/fr.po b/po/fr.po index a8699d866..7fa3e732e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" -"PO-Revision-Date: 2023-06-10 20:30+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" +"PO-Revision-Date: 2023-06-10 22:37+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -3791,6 +3791,12 @@ msgstr "" msgid "names of filters" msgstr "noms des filtres" +msgid "names of disabled filters" +msgstr "noms des filtres désactivés" + +msgid "names of enabled filters" +msgstr "noms des filtres activés" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/hu.po b/po/hu.po index 26aafbe1b..322d7d887 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -2657,6 +2657,14 @@ msgstr "" msgid "names of filters" msgstr "Aliaszok listája:\n" +#, fuzzy +msgid "names of disabled filters" +msgstr "Aliaszok listája:\n" + +#, fuzzy +msgid "names of enabled filters" +msgstr "Aliaszok listája:\n" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/it.po b/po/it.po index f130ded76..d72073853 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -3170,6 +3170,16 @@ msgstr "" msgid "names of filters" msgstr "nomi dei filtri" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "nomi dei filtri" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "nomi dei filtri" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/ja.po b/po/ja.po index 68c78b9a1..85ebf99d3 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" @@ -4115,6 +4115,16 @@ msgstr "" msgid "names of filters" msgstr "nazwy filtrów" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "nazwy filtrów" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "nazwy filtrów" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/pt.po b/po/pt.po index b40cdee2c..515e62d34 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -3723,6 +3723,16 @@ msgstr "" msgid "names of filters" msgstr "nomes dos filtros" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "nomes dos filtros" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "nomes dos filtros" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/pt_BR.po b/po/pt_BR.po index 08a970779..9aebdcc9d 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -3258,6 +3258,16 @@ msgstr "" msgid "names of filters" msgstr "nomes dos filtros" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "nomes dos filtros" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "nomes dos filtros" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/ru.po b/po/ru.po index 882307c0b..914709fdd 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -2679,6 +2679,14 @@ msgstr "" msgid "names of filters" msgstr "Список сокращений:\n" +#, fuzzy +msgid "names of disabled filters" +msgstr "Список сокращений:\n" + +#, fuzzy +msgid "names of enabled filters" +msgstr "Список сокращений:\n" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/sr.po b/po/sr.po index e056f35ae..2413db08e 100644 --- a/po/sr.po +++ b/po/sr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-14 15:29+0200\n" "Last-Translator: Ivan Pešić \n" "Language-Team: weechat-dev \n" @@ -3723,6 +3723,16 @@ msgstr "" msgid "names of filters" msgstr "имена филтера" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "имена филтера" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "имена филтера" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/tr.po b/po/tr.po index ebd9d5740..7790e8b23 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2023-05-01 20:23+0200\n" "Last-Translator: Emir SARI \n" "Language-Team: weechat-dev \n" @@ -3792,6 +3792,16 @@ msgstr "" msgid "names of filters" msgstr "süzgeçlerin adları" +#, fuzzy +#| msgid "names of filters" +msgid "names of disabled filters" +msgstr "süzgeçlerin adları" + +#, fuzzy +#| msgid "names of filters" +msgid "names of enabled filters" +msgstr "süzgeçlerin adları" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/po/weechat.pot b/po/weechat.pot index a45c42aa4..9d719b160 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-06-10 20:29+0200\n" +"POT-Creation-Date: 2023-06-10 22:36+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -2449,6 +2449,12 @@ msgstr "" msgid "names of filters" msgstr "" +msgid "names of disabled filters" +msgstr "" + +msgid "names of enabled filters" +msgstr "" + msgid "" "commands (weechat and plugins); optional argument: prefix to add before the " "commands" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 921fb40d4..2d6431ed3 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -8294,8 +8294,8 @@ command_init () "all buffers:\n" " /filter add sucks2 * * (?-i)^WeeChat sucks$"), "list" - " || enable %(filters_names)|@" - " || disable %(filters_names)|@" + " || enable %(filters_names_disabled)|@" + " || disable %(filters_names_enabled)|@" " || toggle %(filters_names)|@" " || add|addreplace %(filters_names) %(buffers_plugins_names)|*" " || rename %(filters_names) %(filters_names)" diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c index 150ce8b1d..d6e775be2 100644 --- a/src/core/wee-completion.c +++ b/src/core/wee-completion.c @@ -861,6 +861,68 @@ completion_list_add_filters_cb (const void *pointer, void *data, return WEECHAT_RC_OK; } +/* + * Adds disabled filter names to completion list. + */ + +int +completion_list_add_filters_disabled_cb (const void *pointer, void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_filter *ptr_filter; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_filter = gui_filters; ptr_filter; + ptr_filter = ptr_filter->next_filter) + { + if (!ptr_filter->enabled) + { + gui_completion_list_add (completion, ptr_filter->name, + 0, WEECHAT_LIST_POS_SORT); + } + } + + return WEECHAT_RC_OK; +} + +/* + * Adds enabled filter names to completion list. + */ + +int +completion_list_add_filters_enabled_cb (const void *pointer, void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_filter *ptr_filter; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_filter = gui_filters; ptr_filter; + ptr_filter = ptr_filter->next_filter) + { + if (ptr_filter->enabled) + { + gui_completion_list_add (completion, ptr_filter->name, + 0, WEECHAT_LIST_POS_SORT); + } + } + + return WEECHAT_RC_OK; +} + /* * Adds command hooks to completion list. */ @@ -1991,6 +2053,12 @@ completion_init () hook_completion (NULL, "filters_names", /* formerly "%F" */ N_("names of filters"), &completion_list_add_filters_cb, NULL, NULL); + hook_completion (NULL, "filters_names_disabled", + N_("names of disabled filters"), + &completion_list_add_filters_disabled_cb, NULL, NULL); + hook_completion (NULL, "filters_names_enabled", + N_("names of enabled filters"), + &completion_list_add_filters_enabled_cb, NULL, NULL); hook_completion (NULL, "commands", /* formerly "%h" */ N_("commands (weechat and plugins); " "optional argument: prefix to add before the commands"),