summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-06-28 11:46:17 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-06-28 11:46:17 +0200
commitfa4aaa8aa12b26e90f2a2d4378b20f8bec6cfc39 (patch)
tree5219ac6452fcba7536f5ba1dd5d2341aa05952d5 /src
parent11cc85caeabb0217de67b76164b683b5ebe0e16a (diff)
downloadweechat-fa4aaa8aa12b26e90f2a2d4378b20f8bec6cfc39.zip
core: fix completion of environment variable value when beginning of value is given
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-completion.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c
index c6b323c63..76f67da11 100644
--- a/src/core/wee-completion.c
+++ b/src/core/wee-completion.c
@@ -1496,7 +1496,7 @@ completion_list_add_env_value_cb (void *data,
struct t_gui_completion *completion)
{
char **argv, *value;
- int argc;
+ int argc, arg_index;
/* make C compiler happy */
(void) data;
@@ -1511,7 +1511,10 @@ completion_list_add_env_value_cb (void *data,
if (argc > 0)
{
- value = getenv (argv[argc - 1]);
+ arg_index = completion->base_command_arg_index - 2;
+ if ((arg_index < 1) || (arg_index > argc - 1))
+ arg_index = argc - 1;
+ value = getenv (argv[arg_index]);
if (value)
{
gui_completion_list_add (completion, value,