summaryrefslogtreecommitdiff
path: root/src/core/wee-completion.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-06-28 11:48:49 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-06-28 11:48:49 +0200
commitbaffcc7b76e6f35ea0b35586540969e7faae5572 (patch)
treefd5be5e754642365c56646ed012d2969d10f902b /src/core/wee-completion.c
parentfa4aaa8aa12b26e90f2a2d4378b20f8bec6cfc39 (diff)
downloadweechat-baffcc7b76e6f35ea0b35586540969e7faae5572.zip
core: fix completion of plugins commands when beginning of command is given
Diffstat (limited to 'src/core/wee-completion.c')
-rw-r--r--src/core/wee-completion.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c
index 76f67da11..7301ffde9 100644
--- a/src/core/wee-completion.c
+++ b/src/core/wee-completion.c
@@ -833,7 +833,7 @@ completion_list_add_plugins_commands_cb (void *data,
struct t_gui_completion *completion)
{
char **argv;
- int argc;
+ int argc, arg_index;
struct t_weechat_plugin *ptr_plugin;
struct t_hook *ptr_hook;
@@ -850,14 +850,17 @@ completion_list_add_plugins_commands_cb (void *data,
if (argc > 0)
{
+ arg_index = completion->base_command_arg_index - 2;
+ if ((arg_index < 0) || (arg_index > argc - 1))
+ arg_index = argc - 1;
ptr_plugin = NULL;
- if (string_strcasecmp (argv[argc - 1], PLUGIN_CORE) != 0)
+ if (string_strcasecmp (argv[arg_index], PLUGIN_CORE) != 0)
{
/*
* plugin name is different from "core", then search it in
* plugin list
*/
- ptr_plugin = plugin_search (argv[argc - 1]);
+ ptr_plugin = plugin_search (argv[arg_index]);
if (!ptr_plugin)
return WEECHAT_RC_OK;
}