]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.1260 v7.3.1260
authorBram Moolenaar <Bram@vim.org>
Sat, 29 Jun 2013 10:58:33 +0000 (12:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 29 Jun 2013 10:58:33 +0000 (12:58 +0200)
Problem:    User completion does not get the whole command line in the command
            line window.
Solution:   Pass on the whole command line. (Daniel Thau)

src/ex_getln.c
src/structs.h
src/version.c

index ec64619e4db9e8b883d2375bcd98513c69a054c7..18a708bf980a617c4a4881125c21da94fe71b5a3 100644 (file)
@@ -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. */
index bfe1919b637defb94278d4c56f5b4821884a7bfb..96435eda72f3b630088a54fbe86edb5d094bc023 100644 (file)
@@ -493,6 +493,8 @@ typedef struct expand
     int                xp_numfiles;            /* number of files found by
                                                    file name completion */
     char_u     **xp_files;             /* list of files */
+    char_u     *xp_line;               /* text being completed */
+    int                xp_col;                 /* cursor position in line */
 } expand_T;
 
 /* values for xp_backslash */
index d9e62dd488e65530785d819f22814c430e1f8217..60d0d10da1d1a0bb96e70bac9918a6f4c9236627 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1260,
 /**/
     1259,
 /**/