summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config.c7
-rw-r--r--src/core/wee-config.h1
-rw-r--r--src/gui/gui-completion.c15
3 files changed, 19 insertions, 4 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 54c78bb92..0bbaea4e3 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -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;
@@ -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",
diff --git a/src/core/wee-config.h b/src/core/wee-config.h
index ece8dd752..1ab3b763d 100644
--- a/src/core/wee-config.h
+++ b/src/core/wee-config.h
@@ -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;
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index d5ece75fe..22c151f1d 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -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);