summaryrefslogtreecommitdiff
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-06-29 12:58:33 +0200
committerBram Moolenaar <Bram@vim.org>2013-06-29 12:58:33 +0200
commitb751546636c71f206733af1bc30415aaab9a0b42 (patch)
treecb96a703d4c93ebc41b5454b7db16c3e90dd1293 /src/ex_getln.c
parent560c52d32b3e509710e5e7fd620feb751e97689b (diff)
downloadvim-git-b751546636c71f206733af1bc30415aaab9a0b42.tar.gz
updated for version 7.3.1260v7.3.1260
Problem: User completion does not get the whole command line in the command line window. Solution: Pass on the whole command line. (Daniel Thau)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index ec64619e4..18a708bf9 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -3729,6 +3729,7 @@ ExpandInit(xp)
#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
xp->xp_arg = NULL;
#endif
+ xp->xp_line = NULL;
}
/*
@@ -4378,6 +4379,11 @@ set_cmd_context(xp, str, len, col)
int old_char = NUL;
char_u *nextcomm;
+ /* Store the string here so that call_user_expand_func() can get to them
+ * easily. */
+ xp->xp_line = str;
+ xp->xp_col = col;
+
/*
* Avoid a UMR warning from Purify, only save the character if it has been
* written before.
@@ -4952,27 +4958,20 @@ call_user_expand_func(user_expand_func, xp, num_file, file)
void *ret;
struct cmdline_info save_ccline;
- if (xp->xp_arg == NULL || xp->xp_arg[0] == '\0')
+ if (xp->xp_arg == NULL || xp->xp_arg[0] == '\0' || xp->xp_line == NULL)
return NULL;
*num_file = 0;
*file = NULL;
- if (ccline.cmdbuff == NULL)
- {
- /* Completion from Insert mode, pass fake arguments. */
- keep = 0;
- sprintf((char *)num, "%d", (int)STRLEN(xp->xp_pattern));
- args[1] = xp->xp_pattern;
- }
- else
+ if (ccline.cmdbuff != NULL)
{
- /* Completion on the command line, pass real arguments. */
keep = ccline.cmdbuff[ccline.cmdlen];
ccline.cmdbuff[ccline.cmdlen] = 0;
- sprintf((char *)num, "%d", ccline.cmdpos);
- args[1] = ccline.cmdbuff;
}
+
args[0] = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len);
+ args[1] = xp->xp_line;
+ sprintf((char *)num, "%d", xp->xp_col);
args[2] = num;
/* Save the cmdline, we don't know what the function may do. */