Blob Blame History Raw
To: vim-dev@vim.org
Subject: patch 7.1.081
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.081
Problem:    Command line completion for a shell command: "cat </tmp/file<Tab>"
	    doesn't work.
Solution:   Start the file name at any character that can't be in a file name.
	    (Martin Toft)
Files:	    src/ex_docmd.c


*** ../vim-7.1.080/src/ex_docmd.c	Tue Aug 14 22:54:00 2007
--- src/ex_docmd.c	Sat Aug 18 14:58:53 2007
***************
*** 3281,3319 ****
  
      if (ea.argt & XFILE)
      {
! 	int in_quote = FALSE;
! 	char_u *bow = NULL;	/* Beginning of word */
  
  	/*
  	 * Allow spaces within back-quotes to count as part of the argument
  	 * being expanded.
  	 */
  	xp->xp_pattern = skipwhite(arg);
! 	for (p = xp->xp_pattern; *p; )
  	{
! 	    if (*p == '\\' && p[1] != NUL)
  		++p;
  #ifdef SPACE_IN_FILENAME
! 	    else if (vim_iswhite(*p) && (!(ea.argt & NOSPC) || usefilter))
  #else
! 	    else if (vim_iswhite(*p))
  #endif
  	    {
! 		p = skipwhite(p);
  		if (in_quote)
  		    bow = p;
  		else
  		    xp->xp_pattern = p;
! 		--p;
! 	    }
! 	    else if (*p == '`')
! 	    {
! 		if (!in_quote)
! 		{
! 		    xp->xp_pattern = p;
! 		    bow = p + 1;
! 		}
! 		in_quote = !in_quote;
  	    }
  	    mb_ptr_adv(p);
  	}
--- 3281,3344 ----
  
      if (ea.argt & XFILE)
      {
! 	int	c;
! 	int	in_quote = FALSE;
! 	char_u	*bow = NULL;	/* Beginning of word */
  
  	/*
  	 * Allow spaces within back-quotes to count as part of the argument
  	 * being expanded.
  	 */
  	xp->xp_pattern = skipwhite(arg);
! 	p = xp->xp_pattern;
! 	while (*p != NUL)
  	{
! #ifdef FEAT_MBYTE
! 	    if (has_mbyte)
! 		c = mb_ptr2char(p);
! 	    else
! #endif
! 		c = *p;
! 	    if (c == '\\' && p[1] != NUL)
  		++p;
+ 	    else if (c == '`')
+ 	    {
+ 		if (!in_quote)
+ 		{
+ 		    xp->xp_pattern = p;
+ 		    bow = p + 1;
+ 		}
+ 		in_quote = !in_quote;
+ 	    }
  #ifdef SPACE_IN_FILENAME
! 	    else if (!vim_isfilec(c) && (!(ea.argt & NOSPC) || usefilter))
  #else
! 	    else if (!vim_isfilec(c))
  #endif
  	    {
! 		while (*p != NUL)
! 		{
! #ifdef FEAT_MBYTE
! 		    if (has_mbyte)
! 			c = mb_ptr2char(p);
! 		    else
! #endif
! 			c = *p;
! 		    if (c == '`' || vim_isfilec(c))
! 			break;
! #ifdef FEAT_MBYTE
! 		    if (has_mbyte)
! 			len = (*mb_ptr2len)(p);
! 		    else
! #endif
! 			len = 1;
! 		    mb_ptr_adv(p);
! 		}
  		if (in_quote)
  		    bow = p;
  		else
  		    xp->xp_pattern = p;
! 		p -= len;
  	    }
  	    mb_ptr_adv(p);
  	}
*** ../vim-7.1.080/src/version.c	Sat Aug 18 16:59:43 2007
--- src/version.c	Sat Aug 18 17:45:54 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     81,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
194. Your business cards contain your e-mail and home page address.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///