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