mirror of
https://github.com/weechat/weechat.git
synced 2026-07-02 07:46:38 +02:00
core: add option weechat.completion.nick_case_sensitive (closes #981)
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user