1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: add option weechat.completion.nick_ignore_words (closes #1143)

This commit is contained in:
Sébastien Helleu
2025-03-03 08:27:22 +01:00
parent 8280a3b65b
commit 2e570c599b
18 changed files with 563 additions and 348 deletions
+1
View File
@@ -12,6 +12,7 @@
- core: add command `/pipe`
- core: add option `whitespace` in command `/debug`, add options weechat.look.whitespace_char and weechat.look.tab_whitespace_char ([#947](https://github.com/weechat/weechat/issues/947))
- core: add option weechat.completion.nick_ignore_words ([#1143](https://github.com/weechat/weechat/issues/1143))
- api: add function completion_set
- relay/api: add resource `POST /api/completion` ([#2207](https://github.com/weechat/weechat/issues/2207))
- relay/api: add default key `Alt`+`Ctrl`+`l` (L) to toggle between remote and local commands on remote buffers, add option `togglecmd` in command `/remote`, add options relay.api.remote_input_cmd_local and relay.api.remote_input_cmd_remote ([#2148](https://github.com/weechat/weechat/issues/2148))
+8 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-11-20 18:17+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5426,6 +5426,13 @@ msgstr "dokončit pouze s prvním nalezenou přezdívkou"
msgid "chars ignored for nick completion"
msgstr "znaky ignorovány pro doplňování přezdívky"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
#, fuzzy
msgid "send alert (BEL) when a partial completion occurs"
msgstr "upozornit uživatele pokud nastane částečné doplnění"
+338 -333
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-11-20 18:17+0100\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5563,6 +5563,13 @@ msgstr "completar únicamente con el primer apodo encontrado"
msgid "chars ignored for nick completion"
msgstr "caracteres ignorados para el completado de un apodo"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
#, fuzzy
msgid "send alert (BEL) when a partial completion occurs"
msgstr "alertar al usuario cuando ocurre un completado parcial"
+14 -2
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"PO-Revision-Date: 2025-02-18 22:08+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2025-03-03 08:22+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -6049,6 +6049,18 @@ msgstr "compléter seulement avec le premier pseudo trouvé"
msgid "chars ignored for nick completion"
msgstr "caractères à ignorer pour la complétion des pseudos"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
"liste de pseudos à ignorer (non complétés), séparés par des virgules; "
"chaque pseudo dans la liste doit inclure les caractères ignorés (par "
"l'option weechat.completion.nick_ignore_chars); la recherche de pseudos "
"s'effectue avec la casse exacte puis en minuscules, donc il est possible "
"d'utiliser uniquement des minuscules pour les pseudos dans cette option"
msgid "send alert (BEL) when a partial completion occurs"
msgstr "envoyer une alerte (BEL) lorsqu'une complétion partielle survient"
+8 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-11-20 18:17+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5131,6 +5131,13 @@ msgstr "kiegészítés az első adandó névvel"
msgid "chars ignored for nick completion"
msgstr "névkiegészítéskor mellőzött karakterek"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
msgid "send alert (BEL) when a partial completion occurs"
msgstr ""
+8 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-11-20 18:17+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5546,6 +5546,13 @@ msgstr "completa solo con il primo nick trovato"
msgid "chars ignored for nick completion"
msgstr "caratteri ignorati per il completamento dei nick"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
#, fuzzy
msgid "send alert (BEL) when a partial completion occurs"
msgstr "avvisa l'utente quando si verifica un completamento parziale"
+8 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-11-20 18:17+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -5727,6 +5727,13 @@ msgstr "最初に見つかったニックネームだけを補完"
msgid "chars ignored for nick completion"
msgstr "ニックネーム補完で無視する文字"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
msgid "send alert (BEL) when a partial completion occurs"
msgstr "補完候補が複数あった場合に警告 (BEL) を送信"
+8 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-12-16 12:01+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6024,6 +6024,13 @@ msgstr "dopełniaj tylko pierwszym znalezionym nickiem"
msgid "chars ignored for nick completion"
msgstr "znaki ignorowane przy dopełnieniu nicków"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
msgid "send alert (BEL) when a partial completion occurs"
msgstr "wyślij alarm (BEL), kiedy nastąpi częściowe dopełnienie"
+8 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-11-20 18:17+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -5764,6 +5764,13 @@ msgstr "completar só com o primeiro nick encontrado"
msgid "chars ignored for nick completion"
msgstr "carateres ignorados ao completar um nick"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
#, fuzzy
msgid "send alert (BEL) when a partial completion occurs"
msgstr "alertar o utilizador ao completar parcialmente"
+8 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-11-20 18:17+0100\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5467,6 +5467,13 @@ msgstr "completa apenas com o primeiro apelido encontrado"
msgid "chars ignored for nick completion"
msgstr "caracteres ignorados para completação de apelido"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
#, fuzzy
msgid "send alert (BEL) when a partial completion occurs"
msgstr "alertar usuário quando uma completação parcial ocorre"
+8 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2024-11-20 18:17+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5165,6 +5165,13 @@ msgstr "дополнять только первым найденным нико
msgid "chars ignored for nick completion"
msgstr "символы, игнорируемые при автодополнении ника"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
msgid "send alert (BEL) when a partial completion occurs"
msgstr ""
+8 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2025-02-12 11:16+0400\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5839,6 +5839,13 @@ msgstr "довршава се само први пронађени надима
msgid "chars ignored for nick completion"
msgstr "карактери који се игноришу при довршавању надимка"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
msgid "send alert (BEL) when a partial completion occurs"
msgstr "шаље упозорење (BEL) када се догоди делимично довршавање"
+8 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2025-01-04 18:21+0100\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5720,6 +5720,13 @@ msgstr "yalnızca ilk bulunan takma ad ile tamamla"
msgid "chars ignored for nick completion"
msgstr "takma ad tamamlamasında yok sayılan karakterler"
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
msgid "send alert (BEL) when a partial completion occurs"
msgstr "kısmi bir tamamlama gerçekleştiğinde uyarı (BEL) gönder"
+8 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2025-02-18 22:07+0100\n"
"POT-Creation-Date: 2025-03-03 08:19+0100\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4791,6 +4791,13 @@ msgstr ""
msgid "chars ignored for nick completion"
msgstr ""
msgid ""
"comma-separated list of nicks to ignore (not completed); each nick in list "
"must include ignored chars (by option weechat.completion.nick_ignore_chars); "
"look up for nicks is with exact case then lower case, so it's possible to "
"use only lower case for nicks in this option"
msgstr ""
msgid "send alert (BEL) when a partial completion occurs"
msgstr ""
+72
View File
@@ -309,6 +309,7 @@ struct t_config_option *config_completion_nick_case_sensitive = NULL;
struct t_config_option *config_completion_nick_completer = NULL;
struct t_config_option *config_completion_nick_first_only = NULL;
struct t_config_option *config_completion_nick_ignore_chars = NULL;
struct t_config_option *config_completion_nick_ignore_words = NULL;
struct t_config_option *config_completion_partial_completion_alert = NULL;
struct t_config_option *config_completion_partial_completion_command = NULL;
struct t_config_option *config_completion_partial_completion_command_arg = NULL;
@@ -375,6 +376,7 @@ char **config_eval_syntax_colors = NULL;
int config_num_eval_syntax_colors = 0;
char *config_item_time_evaluated = NULL;
char *config_buffer_time_same_evaluated = NULL;
struct t_hashtable *config_hashtable_completion_nick_ignore_words = NULL;
struct t_hashtable *config_hashtable_completion_partial_templates = NULL;
char **config_hotlist_sort_fields = NULL;
int config_num_hotlist_sort_fields = 0;
@@ -1420,6 +1422,56 @@ config_change_eval_syntax_colors (const void *pointer, void *data,
gui_color_buffer_display ();
}
/*
* Callback for changes on option "weechat.completion.nick_ignore_words".
*/
void
config_change_completion_nick_ignore_words (const void *pointer,
void *data,
struct t_config_option *option)
{
char **words;
int num_words, i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
if (!config_hashtable_completion_nick_ignore_words)
{
config_hashtable_completion_nick_ignore_words = hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL, NULL);
}
else
{
hashtable_remove_all (config_hashtable_completion_nick_ignore_words);
}
words = string_split (
CONFIG_STRING(config_completion_nick_ignore_words),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_words);
if (words)
{
for (i = 0; i < num_words; i++)
{
hashtable_set (config_hashtable_completion_nick_ignore_words,
words[i], NULL);
}
string_free_split (words);
}
}
/*
* Callback for changes on option
* "weechat.completion.partial_completion_templates".
@@ -5174,6 +5226,18 @@ config_weechat_init_options ()
N_("chars ignored for nick completion"),
NULL, 0, 0, "[]`_-^", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_nick_ignore_words = config_file_new_option (
weechat_config_file, weechat_config_section_completion,
"nick_ignore_words", "string",
N_("comma-separated list of nicks to ignore (not completed); "
"each nick in list must include ignored chars (by option "
"weechat.completion.nick_ignore_chars); look up for nicks is with "
"exact case then lower case, so it's possible to use only lower "
"case for nicks in this option"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL,
&config_change_completion_nick_ignore_words, NULL, NULL,
NULL, NULL, NULL);
config_completion_partial_completion_alert = config_file_new_option (
weechat_config_file, weechat_config_section_completion,
"partial_completion_alert", "boolean",
@@ -5572,6 +5636,8 @@ config_weechat_init ()
config_change_word_chars_highlight (NULL, NULL, NULL);
if (!config_word_chars_input)
config_change_word_chars_input (NULL, NULL, NULL);
if (!config_hashtable_completion_nick_ignore_words)
config_change_completion_nick_ignore_words (NULL, NULL, NULL);
if (!config_hashtable_completion_partial_templates)
config_change_completion_partial_completion_templates (NULL, NULL, NULL);
@@ -5699,6 +5765,12 @@ config_weechat_free ()
config_buffer_time_same_evaluated = NULL;
}
if (config_hashtable_completion_nick_ignore_words)
{
hashtable_free (config_hashtable_completion_nick_ignore_words);
config_hashtable_completion_nick_ignore_words = NULL;
}
if (config_hashtable_completion_partial_templates)
{
hashtable_free (config_hashtable_completion_partial_templates);
+2
View File
@@ -358,6 +358,7 @@ extern struct t_config_option *config_completion_nick_case_sensitive;
extern struct t_config_option *config_completion_nick_completer;
extern struct t_config_option *config_completion_nick_first_only;
extern struct t_config_option *config_completion_nick_ignore_chars;
extern struct t_config_option *config_completion_nick_ignore_words;
extern struct t_config_option *config_completion_partial_completion_alert;
extern struct t_config_option *config_completion_partial_completion_command;
extern struct t_config_option *config_completion_partial_completion_command_arg;
@@ -410,6 +411,7 @@ extern struct t_hashtable *config_hashtable_nick_color_force;
extern char **config_eval_syntax_colors;
extern int config_num_eval_syntax_colors;
extern char *config_buffer_time_same_evaluated;
extern struct t_hashtable *config_hashtable_completion_nick_ignore_words;
extern struct t_hashtable *config_hashtable_completion_partial_templates;
extern char **config_hotlist_sort_fields;
extern int config_num_hotlist_sort_fields;
+40 -1
View File
@@ -452,6 +452,44 @@ gui_completion_strncmp (struct t_gui_completion *completion,
string_strncasecmp (string1, string2, max);
}
/*
* Checks if a nick is ignored from completion (no completion with this nick).
*
* Returns:
* 1: nick ignored
* 0: nick NOT ignored (can be used in completion)
*/
int
gui_completion_nick_ignored (const char *nick)
{
char *nick_lower;
int rc;
if (!config_hashtable_completion_nick_ignore_words
|| (config_hashtable_completion_nick_ignore_words->items_count == 0))
{
return 0;
}
if (hashtable_has_key (config_hashtable_completion_nick_ignore_words, nick))
return 1;
rc = 0;
nick_lower = string_tolower (nick);
if (nick_lower)
{
if (hashtable_has_key (config_hashtable_completion_nick_ignore_words,
nick_lower))
{
rc = 1;
}
free (nick_lower);
}
return rc;
}
/*
* Adds a word to completion list.
*/
@@ -470,7 +508,8 @@ gui_completion_list_add (struct t_gui_completion *completion, const char *word,
if (!completion->base_word || !completion->base_word[0]
|| (nick_completion
&& (gui_completion_nickncmp (completion->base_word, word,
utf8_strlen (completion->base_word)) == 0))
utf8_strlen (completion->base_word)) == 0)
&& !gui_completion_nick_ignored (word))
|| (!nick_completion
&& (gui_completion_strncmp (completion,
completion->base_word, word,