diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2006-08-26 23:00:09 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2006-08-26 23:00:09 +0000 |
commit | ce72bdb9f028f80ab9a65708ddb5885b80e50a05 (patch) | |
tree | 1649e2d8c417f33b291f1b4ee9e27e6e8b31c305 /src/common/completion.c | |
parent | cb334b6de3b1793a3caf81dec83b994b9b85a0e8 (diff) | |
download | weechat-ce72bdb9f028f80ab9a65708ddb5885b80e50a05.zip |
Fixed completion with alias calling user arguments ($1..$9)
Diffstat (limited to 'src/common/completion.c')
-rw-r--r-- | src/common/completion.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/common/completion.c b/src/common/completion.c index aab62a82b..324fc7f7d 100644 --- a/src/common/completion.c +++ b/src/common/completion.c @@ -118,8 +118,8 @@ completion_get_command_infos (t_completion *completion, char **template, int *max_arg) { t_weechat_alias *ptr_alias; - char *ptr_command; - int i; + char *ptr_command, *pos; + int i, length; #ifdef PLUGINS t_weechat_plugin *ptr_plugin; t_plugin_handler *ptr_handler; @@ -137,6 +137,12 @@ completion_get_command_infos (t_completion *completion, } else ptr_command = completion->base_command; + + pos = strchr (ptr_command, ' '); + if (pos) + length = pos - ptr_command; + else + length = strlen (ptr_command); #ifdef PLUGINS /* look for plugin command handler */ @@ -147,8 +153,8 @@ completion_get_command_infos (t_completion *completion, ptr_handler; ptr_handler = ptr_handler->next_handler) { if ((ptr_handler->type == HANDLER_COMMAND) - && (ascii_strcasecmp (ptr_handler->command, - ptr_command) == 0)) + && (ascii_strncasecmp (ptr_handler->command, + ptr_command, length) == 0)) { *template = ptr_handler->completion_template; *max_arg = MAX_ARGS; @@ -161,8 +167,8 @@ completion_get_command_infos (t_completion *completion, /* look for WeeChat internal command */ for (i = 0; weechat_commands[i].command_name; i++) { - if (ascii_strcasecmp (weechat_commands[i].command_name, - ptr_command) == 0) + if (ascii_strncasecmp (weechat_commands[i].command_name, + ptr_command, length) == 0) { *template = weechat_commands[i].completion_template; *max_arg = weechat_commands[i].max_arg; @@ -174,8 +180,8 @@ completion_get_command_infos (t_completion *completion, for (i = 0; irc_commands[i].command_name; i++) { if ((irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg) - && (ascii_strcasecmp (irc_commands[i].command_name, - ptr_command) == 0)) + && (ascii_strncasecmp (irc_commands[i].command_name, + ptr_command, length) == 0)) { *template = irc_commands[i].completion_template; *max_arg = irc_commands[i].max_arg; |