From 2bd8e91b54625a8758d7ed6e272db7c291cafb3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 27 Apr 2020 22:18:03 +0200 Subject: [PATCH] api: add hdata "completion_word" (issue #1484) --- ChangeLog.adoc | 1 + doc/de/autogen/plugin_api/hdata.adoc | 9 +++++++++ doc/en/autogen/plugin_api/hdata.adoc | 9 +++++++++ doc/fr/autogen/plugin_api/hdata.adoc | 9 +++++++++ doc/it/autogen/plugin_api/hdata.adoc | 9 +++++++++ doc/ja/autogen/plugin_api/hdata.adoc | 9 +++++++++ doc/pl/autogen/plugin_api/hdata.adoc | 9 +++++++++ po/cs.po | 6 +++++- po/de.po | 6 +++++- po/es.po | 6 +++++- po/fr.po | 7 +++++-- po/hu.po | 6 +++++- po/it.po | 6 +++++- po/ja.po | 6 +++++- po/pl.po | 6 +++++- po/pt.po | 6 +++++- po/pt_BR.po | 6 +++++- po/ru.po | 6 +++++- po/tr.po | 5 ++++- po/weechat.pot | 5 ++++- src/gui/gui-completion.c | 24 ++++++++++++++++++++++++ src/gui/gui-completion.h | 3 +++ src/plugins/plugin-api.c | 3 +++ 23 files changed, 148 insertions(+), 14 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index af1dbd3fa..c9836a574 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -24,6 +24,7 @@ New features:: * core: add command line option "--stdout" in weechat-headless binary to log to stdout rather than ~/.weechat/weechat.log (issue #1475, issue #1477) * core: reload configuration files on SIGHUP (issue #1476) * api: add functions completion_new, completion_search and completion_free + * api: add hdata "completion_word" * buflist: add default key kbd:[Alt+Shift+B] to toggle buflist * buflist: add options enable/disable/toggle in command /buflist * buflist: evaluate option buflist.look.sort so that sort can be customized for each of the three buflist bar items (issue #1465) diff --git a/doc/de/autogen/plugin_api/hdata.adoc b/doc/de/autogen/plugin_api/hdata.adoc index cfb992f04..65429fdc0 100644 --- a/doc/de/autogen/plugin_api/hdata.adoc +++ b/doc/de/autogen/plugin_api/hdata.adoc @@ -670,6 +670,15 @@ _prev_completion_   (pointer, hdata: "completion") + _next_completion_   (pointer, hdata: "completion") + +| weechat +| [[hdata_completion_word]]<> +| structure with word found for a completion +| - +| _word_   (string) + +_nick_completion_   (char) + +_count_   (integer) + + + | weechat | [[hdata_config_file]]<> | Konfigurationsdatei diff --git a/doc/en/autogen/plugin_api/hdata.adoc b/doc/en/autogen/plugin_api/hdata.adoc index f3b9338e5..7477f63c9 100644 --- a/doc/en/autogen/plugin_api/hdata.adoc +++ b/doc/en/autogen/plugin_api/hdata.adoc @@ -670,6 +670,15 @@ _prev_completion_   (pointer, hdata: "completion") + _next_completion_   (pointer, hdata: "completion") + +| weechat +| [[hdata_completion_word]]<> +| structure with word found for a completion +| - +| _word_   (string) + +_nick_completion_   (char) + +_count_   (integer) + + + | weechat | [[hdata_config_file]]<> | config file diff --git a/doc/fr/autogen/plugin_api/hdata.adoc b/doc/fr/autogen/plugin_api/hdata.adoc index 38839bff2..8cfa33bac 100644 --- a/doc/fr/autogen/plugin_api/hdata.adoc +++ b/doc/fr/autogen/plugin_api/hdata.adoc @@ -670,6 +670,15 @@ _prev_completion_   (pointer, hdata: "completion") + _next_completion_   (pointer, hdata: "completion") + +| weechat +| [[hdata_completion_word]]<> +| structure avec un mot trouvé pour une complétion +| - +| _word_   (string) + +_nick_completion_   (char) + +_count_   (integer) + + + | weechat | [[hdata_config_file]]<> | fichier de configuration diff --git a/doc/it/autogen/plugin_api/hdata.adoc b/doc/it/autogen/plugin_api/hdata.adoc index feab3455d..8df7e4ea7 100644 --- a/doc/it/autogen/plugin_api/hdata.adoc +++ b/doc/it/autogen/plugin_api/hdata.adoc @@ -670,6 +670,15 @@ _prev_completion_   (pointer, hdata: "completion") + _next_completion_   (pointer, hdata: "completion") + +| weechat +| [[hdata_completion_word]]<> +| structure with word found for a completion +| - +| _word_   (string) + +_nick_completion_   (char) + +_count_   (integer) + + + | weechat | [[hdata_config_file]]<> | file di configurazione diff --git a/doc/ja/autogen/plugin_api/hdata.adoc b/doc/ja/autogen/plugin_api/hdata.adoc index 4dce7fd19..049b7a7d1 100644 --- a/doc/ja/autogen/plugin_api/hdata.adoc +++ b/doc/ja/autogen/plugin_api/hdata.adoc @@ -670,6 +670,15 @@ _prev_completion_   (pointer, hdata: "completion") + _next_completion_   (pointer, hdata: "completion") + +| weechat +| [[hdata_completion_word]]<> +| structure with word found for a completion +| - +| _word_   (string) + +_nick_completion_   (char) + +_count_   (integer) + + + | weechat | [[hdata_config_file]]<> | 設定ファイル diff --git a/doc/pl/autogen/plugin_api/hdata.adoc b/doc/pl/autogen/plugin_api/hdata.adoc index 14dc7f1ca..1f986f1bd 100644 --- a/doc/pl/autogen/plugin_api/hdata.adoc +++ b/doc/pl/autogen/plugin_api/hdata.adoc @@ -670,6 +670,15 @@ _prev_completion_   (pointer, hdata: "completion") + _next_completion_   (pointer, hdata: "completion") + +| weechat +| [[hdata_completion_word]]<> +| structure with word found for a completion +| - +| _word_   (string) + +_nick_completion_   (char) + +_count_   (integer) + + + | weechat | [[hdata_config_file]]<> | plik konfiguracyjne diff --git a/po/cs.po b/po/cs.po index f5520cc8f..e709f6378 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -10079,6 +10079,10 @@ msgstr "navštívený buffer" msgid "structure with completion" msgstr "struktura s dokončením" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "struktura s dokončením" + msgid "config file" msgstr "konfigurační soubor" diff --git a/po/de.po b/po/de.po index 7506b3012..1964346e5 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-19 12:01+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -11961,6 +11961,10 @@ msgstr "besuchte Buffer" msgid "structure with completion" msgstr "Struktur mit Vervollständigung" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "Struktur mit Vervollständigung" + msgid "config file" msgstr "Konfigurationsdatei" diff --git a/po/es.po b/po/es.po index 52724a89d..625b6fc8f 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -10394,6 +10394,10 @@ msgstr "lista de buffers" msgid "structure with completion" msgstr "estructura con auto-completador" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "estructura con auto-completador" + msgid "config file" msgstr "archivo de configuración" diff --git a/po/fr.po b/po/fr.po index 140bf8aef..8c60df47f 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: 2020-04-26 09:14+0200\n" -"PO-Revision-Date: 2020-04-26 09:15+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" +"PO-Revision-Date: 2020-04-27 22:16+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -11690,6 +11690,9 @@ msgstr "tampon visité" msgid "structure with completion" msgstr "structure avec une complétion" +msgid "structure with word found for a completion" +msgstr "structure avec un mot trouvé pour une complétion" + msgid "config file" msgstr "fichier de configuration" diff --git a/po/hu.po b/po/hu.po index 8c7309030..00e5d53c3 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -9420,6 +9420,10 @@ msgstr "Aliaszok listája:\n" msgid "structure with completion" msgstr "szöveg beillesztése a parancssorba" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "szöveg beillesztése a parancssorba" + #, fuzzy msgid "config file" msgstr "szerver konfigurációs fájljának újraolvastatása" diff --git a/po/it.po b/po/it.po index 01a55a714..d84ec8129 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -10580,6 +10580,10 @@ msgstr "elenco dei buffer" msgid "structure with completion" msgstr "struttura con completamento" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "struttura con completamento" + msgid "config file" msgstr "file di configurazione" diff --git a/po/ja.po b/po/ja.po index c5cabc630..77cdec463 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" @@ -11423,6 +11423,10 @@ msgstr "odwiedzony bufor" msgid "structure with completion" msgstr "struktura z uzupełnianiem" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "struktura z uzupełnianiem" + msgid "config file" msgstr "plik konfiguracyjne" diff --git a/po/pt.po b/po/pt.po index e8ff781de..12e04e7d9 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -11042,6 +11042,10 @@ msgstr "buffer visitado" msgid "structure with completion" msgstr "estrutura com completação" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "estrutura com completação" + msgid "config file" msgstr "ficheiro de configuração" diff --git a/po/pt_BR.po b/po/pt_BR.po index 4dd85de5a..0fea1ef5b 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -9881,6 +9881,10 @@ msgstr "lista de buffers" msgid "structure with completion" msgstr "estrutura com completação" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "estrutura com completação" + msgid "config file" msgstr "arquivo de configuração" diff --git a/po/ru.po b/po/ru.po index 06aa91dcf..72ca02b8b 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2020-04-18 11:34+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -9456,6 +9456,10 @@ msgstr "Список сокращений:\n" msgid "structure with completion" msgstr "вставить строку в поле ввода" +#, fuzzy +msgid "structure with word found for a completion" +msgstr "вставить строку в поле ввода" + #, fuzzy msgid "config file" msgstr "перезагрузить конфигурационный файл сервера" diff --git a/po/tr.po b/po/tr.po index 1768ac238..aa0398624 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2019-11-03 08:38+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -8609,6 +8609,9 @@ msgstr "" msgid "structure with completion" msgstr "" +msgid "structure with word found for a completion" +msgstr "" + msgid "config file" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 7e9141ffa..8160556b0 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: 2020-04-26 09:14+0200\n" +"POT-Creation-Date: 2020-04-27 22:15+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -8470,6 +8470,9 @@ msgstr "" msgid "structure with completion" msgstr "" +msgid "structure with word found for a completion" +msgstr "" + msgid "config file" msgstr "" diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 615785eea..c36ab940a 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -1509,6 +1509,30 @@ gui_completion_hdata_completion_cb (const void *pointer, void *data, return hdata; } +/* + * Returns hdata for completion word. + */ + +struct t_hdata * +gui_completion_hdata_completion_word_cb (const void *pointer, void *data, + const char *hdata_name) +{ + struct t_hdata *hdata; + + /* make C compiler happy */ + (void) pointer; + (void) data; + + hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, 0, NULL, NULL); + if (hdata) + { + HDATA_VAR(struct t_gui_completion_word, word, STRING, 0, NULL, NULL); + HDATA_VAR(struct t_gui_completion_word, nick_completion, CHAR, 0, NULL, NULL); + HDATA_VAR(struct t_gui_completion_word, count, INTEGER, 0, NULL, NULL); + } + return hdata; +} + /* * Prints list of completion words in WeeChat log file (usually for crash dump). */ diff --git a/src/gui/gui-completion.h b/src/gui/gui-completion.h index 6f5d85ae0..8056d1bf8 100644 --- a/src/gui/gui-completion.h +++ b/src/gui/gui-completion.h @@ -96,6 +96,9 @@ extern const char *gui_completion_get_string (struct t_gui_completion *completio extern struct t_hdata *gui_completion_hdata_completion_cb (const void *pointer, void *data, const char *hdata_name); +extern struct t_hdata *gui_completion_hdata_completion_word_cb (const void *pointer, + void *data, + const char *hdata_name); extern void gui_completion_print_log (); #endif /* WEECHAT_GUI_COMPLETION_H */ diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 0d862e251..d4cd2fca6 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -649,6 +649,9 @@ plugin_api_init () &gui_buffer_hdata_buffer_visited_cb, NULL, NULL); hook_hdata (NULL, "completion", N_("structure with completion"), &gui_completion_hdata_completion_cb, NULL, NULL); + hook_hdata (NULL, "completion_word", + N_("structure with word found for a completion"), + &gui_completion_hdata_completion_word_cb, NULL, NULL); hook_hdata (NULL, "config_file", N_("config file"), &config_file_hdata_config_file_cb, NULL, NULL); hook_hdata (NULL, "config_section", N_("config section"),