Karsten Hopp 11102c
To: vim-dev@vim.org
Karsten Hopp 11102c
Subject: Patch 7.2.313
Karsten Hopp 11102c
Fcc: outbox
Karsten Hopp 11102c
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 11102c
Mime-Version: 1.0
Karsten Hopp 11102c
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 11102c
Content-Transfer-Encoding: 8bit
Karsten Hopp 11102c
------------
Karsten Hopp 11102c
Karsten Hopp 11102c
Patch 7.2.313
Karsten Hopp 11102c
Problem:    Command line completion doesn't work after "%:h" and similar.
Karsten Hopp 11102c
Solution:   Expand these items before doing the completion.
Karsten Hopp 11102c
Files:	    src/ex_getln.c, src/misc1.c, src/proto/misc1.pro
Karsten Hopp 11102c
Karsten Hopp 11102c
Karsten Hopp 11102c
*** ../vim-7.2.312/src/ex_getln.c	2009-09-18 17:24:54.000000000 +0200
Karsten Hopp 11102c
--- src/ex_getln.c	2009-12-02 16:40:06.000000000 +0100
Karsten Hopp 11102c
***************
Karsten Hopp 11102c
*** 4422,4428 ****
Karsten Hopp 11102c
  	    flags |= EW_FILE;
Karsten Hopp 11102c
  	else
Karsten Hopp 11102c
  	    flags = (flags | EW_DIR) & ~EW_FILE;
Karsten Hopp 11102c
! 	ret = expand_wildcards(1, &pat, num_file, file, flags);
Karsten Hopp 11102c
  	if (free_pat)
Karsten Hopp 11102c
  	    vim_free(pat);
Karsten Hopp 11102c
  	return ret;
Karsten Hopp 11102c
--- 4422,4429 ----
Karsten Hopp 11102c
  	    flags |= EW_FILE;
Karsten Hopp 11102c
  	else
Karsten Hopp 11102c
  	    flags = (flags | EW_DIR) & ~EW_FILE;
Karsten Hopp 11102c
! 	/* Expand wildcards, supporting %:h and the like. */
Karsten Hopp 11102c
! 	ret = expand_wildcards_eval(&pat, num_file, file, flags);
Karsten Hopp 11102c
  	if (free_pat)
Karsten Hopp 11102c
  	    vim_free(pat);
Karsten Hopp 11102c
  	return ret;
Karsten Hopp 11102c
*** ../vim-7.2.312/src/misc1.c	2009-11-17 16:08:12.000000000 +0100
Karsten Hopp 11102c
--- src/misc1.c	2009-12-02 17:06:49.000000000 +0100
Karsten Hopp 11102c
***************
Karsten Hopp 11102c
*** 8447,8452 ****
Karsten Hopp 11102c
--- 8447,8492 ----
Karsten Hopp 11102c
  }
Karsten Hopp 11102c
  
Karsten Hopp 11102c
  /*
Karsten Hopp 11102c
+  * Invoke expand_wildcards() for one pattern.
Karsten Hopp 11102c
+  * Expand items like "%:h" before the expansion.
Karsten Hopp 11102c
+  * Returns OK or FAIL.
Karsten Hopp 11102c
+  */
Karsten Hopp 11102c
+     int
Karsten Hopp 11102c
+ expand_wildcards_eval(pat, num_file, file, flags)
Karsten Hopp 11102c
+     char_u	 **pat;		/* pointer to input pattern */
Karsten Hopp 11102c
+     int		  *num_file;	/* resulting number of files */
Karsten Hopp 11102c
+     char_u	***file;	/* array of resulting files */
Karsten Hopp 11102c
+     int		   flags;	/* EW_DIR, etc. */
Karsten Hopp 11102c
+ {
Karsten Hopp 11102c
+     int		ret = FAIL;
Karsten Hopp 11102c
+     char_u	*eval_pat = NULL;
Karsten Hopp 11102c
+     char_u	*exp_pat = *pat;
Karsten Hopp 11102c
+     char_u      *ignored_msg;
Karsten Hopp 11102c
+     int		usedlen;
Karsten Hopp 11102c
+ 
Karsten Hopp 11102c
+     if (*exp_pat == '%' || *exp_pat == '#' || *exp_pat == '<')
Karsten Hopp 11102c
+     {
Karsten Hopp 11102c
+ 	++emsg_off;
Karsten Hopp 11102c
+ 	eval_pat = eval_vars(exp_pat, exp_pat, &usedlen,
Karsten Hopp 11102c
+ 						    NULL, &ignored_msg, NULL);
Karsten Hopp 11102c
+ 	--emsg_off;
Karsten Hopp 11102c
+ 	if (eval_pat != NULL)
Karsten Hopp 11102c
+ 	    exp_pat = concat_str(eval_pat, exp_pat + usedlen);
Karsten Hopp 11102c
+     }
Karsten Hopp 11102c
+ 
Karsten Hopp 11102c
+     if (exp_pat != NULL)
Karsten Hopp 11102c
+ 	ret = expand_wildcards(1, &exp_pat, num_file, file, flags);
Karsten Hopp 11102c
+ 
Karsten Hopp 11102c
+     if (eval_pat != NULL)
Karsten Hopp 11102c
+     {
Karsten Hopp 11102c
+ 	vim_free(exp_pat);
Karsten Hopp 11102c
+ 	vim_free(eval_pat);
Karsten Hopp 11102c
+     }
Karsten Hopp 11102c
+ 
Karsten Hopp 11102c
+     return ret;
Karsten Hopp 11102c
+ }
Karsten Hopp 11102c
+ 
Karsten Hopp 11102c
+ /*
Karsten Hopp 11102c
   * Expand wildcards.  Calls gen_expand_wildcards() and removes files matching
Karsten Hopp 11102c
   * 'wildignore'.
Karsten Hopp 11102c
   * Returns OK or FAIL.
Karsten Hopp 11102c
*** ../vim-7.2.312/src/proto/misc1.pro	2007-09-26 22:36:32.000000000 +0200
Karsten Hopp 11102c
--- src/proto/misc1.pro	2009-12-02 16:41:52.000000000 +0100
Karsten Hopp 11102c
***************
Karsten Hopp 11102c
*** 85,90 ****
Karsten Hopp 11102c
--- 85,91 ----
Karsten Hopp 11102c
  int vim_fexists __ARGS((char_u *fname));
Karsten Hopp 11102c
  void line_breakcheck __ARGS((void));
Karsten Hopp 11102c
  void fast_breakcheck __ARGS((void));
Karsten Hopp 11102c
+ int expand_wildcards_eval __ARGS((char_u **pat, int *num_file, char_u ***file, int flags));
Karsten Hopp 11102c
  int expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags));
Karsten Hopp 11102c
  int match_suffix __ARGS((char_u *fname));
Karsten Hopp 11102c
  int unix_expandpath __ARGS((garray_T *gap, char_u *path, int wildoff, int flags, int didstar));
Karsten Hopp 11102c
*** ../vim-7.2.312/src/version.c	2009-12-02 15:03:24.000000000 +0100
Karsten Hopp 11102c
--- src/version.c	2009-12-02 17:14:02.000000000 +0100
Karsten Hopp 11102c
***************
Karsten Hopp 11102c
*** 683,684 ****
Karsten Hopp 11102c
--- 683,686 ----
Karsten Hopp 11102c
  {   /* Add new patch number below this line */
Karsten Hopp 11102c
+ /**/
Karsten Hopp 11102c
+     313,
Karsten Hopp 11102c
  /**/
Karsten Hopp 11102c
Karsten Hopp 11102c
-- 
Karsten Hopp 11102c
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 11102c
8. You spend half of the plane trip with your laptop on your lap...and your
Karsten Hopp 11102c
   child in the overhead compartment.
Karsten Hopp 11102c
Karsten Hopp 11102c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 11102c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 11102c
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 11102c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///