Karsten Hopp 87a864
To: vim_dev@googlegroups.com
Karsten Hopp 87a864
Subject: Patch 7.3.615
Karsten Hopp 87a864
Fcc: outbox
Karsten Hopp 87a864
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 87a864
Mime-Version: 1.0
Karsten Hopp 87a864
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 87a864
Content-Transfer-Encoding: 8bit
Karsten Hopp 87a864
------------
Karsten Hopp 87a864
Karsten Hopp 87a864
Patch 7.3.615
Karsten Hopp 87a864
Problem:    Completion for a user command does not recognize backslash before
Karsten Hopp 87a864
	    a space.
Karsten Hopp 87a864
Solution:   Recognize escaped characters. (Yasuhiro Matsumoto)
Karsten Hopp 87a864
Files:	    src/ex_docmd.c
Karsten Hopp 87a864
Karsten Hopp 87a864
Karsten Hopp 87a864
*** ../vim-7.3.614/src/ex_docmd.c	2012-07-10 19:25:06.000000000 +0200
Karsten Hopp 87a864
--- src/ex_docmd.c	2012-07-25 17:10:16.000000000 +0200
Karsten Hopp 87a864
***************
Karsten Hopp 87a864
*** 3390,3401 ****
Karsten Hopp 87a864
  	return NULL;
Karsten Hopp 87a864
  
Karsten Hopp 87a864
      /* Find start of last argument (argument just before cursor): */
Karsten Hopp 87a864
!     p = buff + STRLEN(buff);
Karsten Hopp 87a864
!     while (p != arg && *p != ' ' && *p != TAB)
Karsten Hopp 87a864
! 	p--;
Karsten Hopp 87a864
!     if (*p == ' ' || *p == TAB)
Karsten Hopp 87a864
! 	p++;
Karsten Hopp 87a864
      xp->xp_pattern = p;
Karsten Hopp 87a864
  
Karsten Hopp 87a864
      if (ea.argt & XFILE)
Karsten Hopp 87a864
      {
Karsten Hopp 87a864
--- 3390,3412 ----
Karsten Hopp 87a864
  	return NULL;
Karsten Hopp 87a864
  
Karsten Hopp 87a864
      /* Find start of last argument (argument just before cursor): */
Karsten Hopp 87a864
!     p = buff;
Karsten Hopp 87a864
      xp->xp_pattern = p;
Karsten Hopp 87a864
+     len = STRLEN(buff);
Karsten Hopp 87a864
+     while (*p && p < buff + len)
Karsten Hopp 87a864
+     {
Karsten Hopp 87a864
+ 	if (*p == ' ' || *p == TAB)
Karsten Hopp 87a864
+ 	{
Karsten Hopp 87a864
+ 	    /* argument starts after a space */
Karsten Hopp 87a864
+ 	    xp->xp_pattern = ++p;
Karsten Hopp 87a864
+ 	}
Karsten Hopp 87a864
+ 	else
Karsten Hopp 87a864
+ 	{
Karsten Hopp 87a864
+ 	    if (*p == '\\' && *(p + 1) != NUL)
Karsten Hopp 87a864
+ 		++p; /* skip over escaped character */
Karsten Hopp 87a864
+ 	    mb_ptr_adv(p);
Karsten Hopp 87a864
+ 	}
Karsten Hopp 87a864
+     }
Karsten Hopp 87a864
  
Karsten Hopp 87a864
      if (ea.argt & XFILE)
Karsten Hopp 87a864
      {
Karsten Hopp 87a864
***************
Karsten Hopp 87a864
*** 3821,3828 ****
Karsten Hopp 87a864
  		    if (compl == EXPAND_MAPPINGS)
Karsten Hopp 87a864
  			return set_context_in_map_cmd(xp, (char_u *)"map",
Karsten Hopp 87a864
  					 arg, forceit, FALSE, FALSE, CMD_map);
Karsten Hopp 87a864
! 		    while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL)
Karsten Hopp 87a864
! 			arg = xp->xp_pattern + 1;
Karsten Hopp 87a864
  		    xp->xp_pattern = arg;
Karsten Hopp 87a864
  		}
Karsten Hopp 87a864
  		xp->xp_context = compl;
Karsten Hopp 87a864
--- 3832,3853 ----
Karsten Hopp 87a864
  		    if (compl == EXPAND_MAPPINGS)
Karsten Hopp 87a864
  			return set_context_in_map_cmd(xp, (char_u *)"map",
Karsten Hopp 87a864
  					 arg, forceit, FALSE, FALSE, CMD_map);
Karsten Hopp 87a864
! 		    /* Find start of last argument. */
Karsten Hopp 87a864
! 		    p = arg;
Karsten Hopp 87a864
! 		    while (*p)
Karsten Hopp 87a864
! 		    {
Karsten Hopp 87a864
! 			if (*p == ' ')
Karsten Hopp 87a864
! 			{
Karsten Hopp 87a864
! 			    /* argument starts after a space */
Karsten Hopp 87a864
! 			    arg = p + 1;
Karsten Hopp 87a864
! 			}
Karsten Hopp 87a864
! 			else
Karsten Hopp 87a864
! 			{
Karsten Hopp 87a864
! 			    if (*p == '\\' && *(p + 1) != NUL)
Karsten Hopp 87a864
! 				++p; /* skip over escaped character */
Karsten Hopp 87a864
! 			    mb_ptr_adv(p);
Karsten Hopp 87a864
! 			}
Karsten Hopp 87a864
! 		    }
Karsten Hopp 87a864
  		    xp->xp_pattern = arg;
Karsten Hopp 87a864
  		}
Karsten Hopp 87a864
  		xp->xp_context = compl;
Karsten Hopp 87a864
*** ../vim-7.3.614/src/version.c	2012-07-25 16:46:59.000000000 +0200
Karsten Hopp 87a864
--- src/version.c	2012-07-25 17:17:05.000000000 +0200
Karsten Hopp 87a864
***************
Karsten Hopp 87a864
*** 716,717 ****
Karsten Hopp 87a864
--- 716,719 ----
Karsten Hopp 87a864
  {   /* Add new patch number below this line */
Karsten Hopp 87a864
+ /**/
Karsten Hopp 87a864
+     615,
Karsten Hopp 87a864
  /**/
Karsten Hopp 87a864
Karsten Hopp 87a864
-- 
Karsten Hopp 87a864
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 87a864
172. You join listservers just for the extra e-mail.
Karsten Hopp 87a864
Karsten Hopp 87a864
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 87a864
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 87a864
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 87a864
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///