Skip to content

Commit

Permalink
core: add option weechat.completion.nick_case_sensitive (closes #981)
Browse files Browse the repository at this point in the history
  • Loading branch information
flashcode committed May 6, 2017
1 parent 90a9a1f commit df00926
Show file tree
Hide file tree
Showing 23 changed files with 109 additions and 18 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Expand Up @@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]

New features::

* core: add option weechat.completion.nick_case_sensitive (issue #981)
* core: add wilcard matching operator (`+=*+` and `+!*+`) in evaluation of expressions (issue #611)
* core: add cut of string in evaluation of expressions with "cut:" (number of chars) and "cutscr:" (number of chars displayed on screen)
* core: add ternary operator (condition) in evaluation of expressions (`${if:condition?value_if_true:value_if_false}`)
Expand Down
6 changes: 6 additions & 0 deletions doc/de/autogen/user/weechat_options.adoc
Expand Up @@ -410,6 +410,12 @@
** Werte: on, off
** Standardwert: `+on+`
* [[option_weechat.completion.nick_case_sensitive]] *weechat.completion.nick_case_sensitive*
** Beschreibung: pass:none[case sensitive completion for nicks]
** Typ: boolesch
** Werte: on, off
** Standardwert: `+off+`
* [[option_weechat.completion.nick_completer]] *weechat.completion.nick_completer*
** Beschreibung: pass:none[fügt eine Zeichenkette hinter die Nick-Vervollständigung ein (sofern ein Nickname das erste Wort in der Kommandozeile ist)]
** Typ: Zeichenkette
Expand Down
6 changes: 6 additions & 0 deletions doc/en/autogen/user/weechat_options.adoc
Expand Up @@ -410,6 +410,12 @@
** values: on, off
** default value: `+on+`
* [[option_weechat.completion.nick_case_sensitive]] *weechat.completion.nick_case_sensitive*
** description: pass:none[case sensitive completion for nicks]
** type: boolean
** values: on, off
** default value: `+off+`
* [[option_weechat.completion.nick_completer]] *weechat.completion.nick_completer*
** description: pass:none[string inserted after nick completion (when nick is first word on command line)]
** type: string
Expand Down
6 changes: 6 additions & 0 deletions doc/fr/autogen/user/weechat_options.adoc
Expand Up @@ -410,6 +410,12 @@
** valeurs: on, off
** valeur par défaut: `+on+`
* [[option_weechat.completion.nick_case_sensitive]] *weechat.completion.nick_case_sensitive*
** description: pass:none[complétion sensible à la casse pour les pseudos]
** type: booléen
** valeurs: on, off
** valeur par défaut: `+off+`
* [[option_weechat.completion.nick_completer]] *weechat.completion.nick_completer*
** description: pass:none[chaîne insérée après la complétion du pseudo (quand le pseudo est le premier mot sur la ligne de commande)]
** type: chaîne
Expand Down
6 changes: 6 additions & 0 deletions doc/it/autogen/user/weechat_options.adoc
Expand Up @@ -410,6 +410,12 @@
** valori: on, off
** valore predefinito: `+on+`
* [[option_weechat.completion.nick_case_sensitive]] *weechat.completion.nick_case_sensitive*
** descrizione: pass:none[case sensitive completion for nicks]
** tipo: bool
** valori: on, off
** valore predefinito: `+off+`
* [[option_weechat.completion.nick_completer]] *weechat.completion.nick_completer*
** descrizione: pass:none[stringa inserita dopo il completamento del nick (quando il nick è la prima parola sulla riga di comando)]
** tipo: stringa
Expand Down
6 changes: 6 additions & 0 deletions doc/ja/autogen/user/weechat_options.adoc
Expand Up @@ -410,6 +410,12 @@
** 値: on, off
** デフォルト値: `+on+`
* [[option_weechat.completion.nick_case_sensitive]] *weechat.completion.nick_case_sensitive*
** 説明: pass:none[case sensitive completion for nicks]
** タイプ: ブール
** 値: on, off
** デフォルト値: `+off+`
* [[option_weechat.completion.nick_completer]] *weechat.completion.nick_completer*
** 説明: pass:none[ニックネーム補完の後に追加する文字列 (ニックネームがコマンドラインの最初にある場合)]
** タイプ: 文字列
Expand Down
6 changes: 6 additions & 0 deletions doc/pl/autogen/user/weechat_options.adoc
Expand Up @@ -410,6 +410,12 @@
** wartości: on, off
** domyślna wartość: `+on+`
* [[option_weechat.completion.nick_case_sensitive]] *weechat.completion.nick_case_sensitive*
** opis: pass:none[case sensitive completion for nicks]
** typ: bool
** wartości: on, off
** domyślna wartość: `+off+`
* [[option_weechat.completion.nick_completer]] *weechat.completion.nick_completer*
** opis: pass:none[ciąg wstawiany po dopełnionym nicku (kiedy nick jest pierwszym słowem w linii poleceń)]
** typ: ciąg
Expand Down
5 changes: 4 additions & 1 deletion po/cs.po
Expand Up @@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-01-06 21:59+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -3811,6 +3811,9 @@ msgstr ""
"přidat mezeru za přezdívku po doplnění (pokud není přezdívka první slovo na "
"příkazovém řádku)"

msgid "case sensitive completion for nicks"
msgstr ""

#, fuzzy
msgid ""
"string inserted after nick completion (when nick is first word on command "
Expand Down
5 changes: 4 additions & 1 deletion po/de.po
Expand Up @@ -19,7 +19,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-05-03 23:14+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
Expand Down Expand Up @@ -4574,6 +4574,9 @@ msgstr ""
"fügt ein Leerzeichen hinter die Nick-Vervollständigung ein (sofern der "
"Nickname nicht das erste Wort in einer Kommandozeile darstellt)"

msgid "case sensitive completion for nicks"
msgstr ""

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
5 changes: 4 additions & 1 deletion po/es.po
Expand Up @@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-01-06 22:01+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -4002,6 +4002,9 @@ msgstr ""
"agregar espacio después de autocompletar un apodo (cuando el apodo no es la "
"primera palabra en la línea de comandos)"

msgid "case sensitive completion for nicks"
msgstr ""

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
7 changes: 5 additions & 2 deletions po/fr.po
Expand Up @@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-05-05 23:17+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-05-06 10:12+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
Expand Down Expand Up @@ -4466,6 +4466,9 @@ msgstr ""
"ajouter un espace après la complétion du pseudo (quand le pseudo n'est pas "
"le premier mot sur la ligne de commande)"

msgid "case sensitive completion for nicks"
msgstr "complétion sensible à la casse pour les pseudos"

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
5 changes: 4 additions & 1 deletion po/hu.po
Expand Up @@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-01-06 22:03+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -3387,6 +3387,9 @@ msgid ""
"add space after nick completion (when nick is not first word on command line)"
msgstr ""

msgid "case sensitive completion for nicks"
msgstr ""

#, fuzzy
msgid ""
"string inserted after nick completion (when nick is first word on command "
Expand Down
5 changes: 4 additions & 1 deletion po/it.po
Expand Up @@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-01-06 22:04+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -4113,6 +4113,9 @@ msgstr ""
"aggiungi uno spazio al completamento del nick (quando non è la prima parola "
"sulla riga di comando)"

msgid "case sensitive completion for nicks"
msgstr ""

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
5 changes: 4 additions & 1 deletion po/ja.po
Expand Up @@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-05-02 09:00+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
Expand Down Expand Up @@ -4271,6 +4271,9 @@ msgstr ""
"ニックネーム補完の後に空白を追加 (コマンドラインの最初がニックネームでない場"
"合は)"

msgid "case sensitive completion for nicks"
msgstr ""

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
5 changes: 4 additions & 1 deletion po/pl.po
Expand Up @@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-04-08 14:49+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -4358,6 +4358,9 @@ msgstr ""
"dodaj spację po dopełnionym nicku (kiedy nick nie jest pierwszym słowem w "
"linii poleceń)"

msgid "case sensitive completion for nicks"
msgstr ""

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
5 changes: 4 additions & 1 deletion po/pt.po
Expand Up @@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-04-08 14:50+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
Expand Down Expand Up @@ -4349,6 +4349,9 @@ msgstr ""
"adicionar espaço depois de completar o nick (quando o nick não é a primeira "
"palavra na linha de comando)"

msgid "case sensitive completion for nicks"
msgstr ""

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
5 changes: 4 additions & 1 deletion po/pt_BR.po
Expand Up @@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2016-09-03 08:24+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -3998,6 +3998,9 @@ msgstr ""
"adiciona espaço após a completação de apelido (quando o apelido não é a "
"primeira palavra na linha de comando)"

msgid "case sensitive completion for nicks"
msgstr ""

#, fuzzy
msgid ""
"string inserted after nick completion (when nick is first word on command "
Expand Down
5 changes: 4 additions & 1 deletion po/ru.po
Expand Up @@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-01-06 22:06+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -3420,6 +3420,9 @@ msgid ""
"add space after nick completion (when nick is not first word on command line)"
msgstr ""

msgid "case sensitive completion for nicks"
msgstr ""

#, fuzzy
msgid ""
"string inserted after nick completion (when nick is first word on command "
Expand Down
5 changes: 4 additions & 1 deletion po/tr.po
Expand Up @@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\n"
"PO-Revision-Date: 2017-01-06 22:07+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -3068,6 +3068,9 @@ msgid ""
"add space after nick completion (when nick is not first word on command line)"
msgstr ""

msgid "case sensitive completion for nicks"
msgstr ""

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
5 changes: 4 additions & 1 deletion po/weechat.pot
Expand Up @@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"POT-Creation-Date: 2017-05-06 10:11+0200\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"
Expand Down Expand Up @@ -3059,6 +3059,9 @@ msgid ""
"add space after nick completion (when nick is not first word on command line)"
msgstr ""

msgid "case sensitive completion for nicks"
msgstr ""

msgid ""
"string inserted after nick completion (when nick is first word on command "
"line)"
Expand Down
7 changes: 7 additions & 0 deletions src/core/wee-config.c
Expand Up @@ -264,6 +264,7 @@ struct t_config_option *config_completion_base_word_until_cursor;
struct t_config_option *config_completion_command_inline;
struct t_config_option *config_completion_default_template;
struct t_config_option *config_completion_nick_add_space;
struct t_config_option *config_completion_nick_case_sensitive;
struct t_config_option *config_completion_nick_completer;
struct t_config_option *config_completion_nick_first_only;
struct t_config_option *config_completion_nick_ignore_chars;
Expand Down Expand Up @@ -4105,6 +4106,12 @@ config_weechat_init_options ()
"command line)"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_nick_case_sensitive = config_file_new_option (
weechat_config_file, ptr_section,
"nick_case_sensitive", "boolean",
N_("case sensitive completion for nicks"),
NULL, 0, 0, "off", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_nick_completer = config_file_new_option (
weechat_config_file, ptr_section,
"nick_completer", "string",
Expand Down
1 change: 1 addition & 0 deletions src/core/wee-config.h
Expand Up @@ -310,6 +310,7 @@ extern struct t_config_option *config_completion_base_word_until_cursor;
extern struct t_config_option *config_completion_command_inline;
extern struct t_config_option *config_completion_default_template;
extern struct t_config_option *config_completion_nick_add_space;
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;
Expand Down
15 changes: 11 additions & 4 deletions src/gui/gui-completion.c
Expand Up @@ -356,19 +356,26 @@ int
gui_completion_nickncmp (const char *base_word, const char *nick, int max)
{
char *base_word2, *nick2;
int return_cmp;
int case_sensitive, return_cmp;

case_sensitive = CONFIG_BOOLEAN(config_completion_nick_case_sensitive);

if (!CONFIG_STRING(config_completion_nick_ignore_chars)
|| !CONFIG_STRING(config_completion_nick_ignore_chars)[0]
|| !base_word || !nick || !base_word[0] || !nick[0]
|| gui_completion_nick_has_ignored_chars (base_word))
return string_strncasecmp (base_word, nick, max);
{
return (case_sensitive) ?
strncmp (base_word, nick, max) :
string_strncasecmp (base_word, nick, max);
}

base_word2 = gui_completion_nick_strdup_ignore_chars (base_word);
nick2 = gui_completion_nick_strdup_ignore_chars (nick);

return_cmp = string_strncasecmp (base_word2, nick2,
utf8_strlen (base_word2));
return_cmp = (case_sensitive) ?
strncmp (base_word2, nick2, utf8_strlen (base_word2)) :
string_strncasecmp (base_word2, nick2, utf8_strlen (base_word2));

free (base_word2);
free (nick2);
Expand Down

0 comments on commit df00926

Please sign in to comment.