Karsten Hopp 9f6c97
# KH: Modified for runtime update
Karsten Hopp 9f6c97
To: vim-dev@vim.org
Karsten Hopp 9f6c97
Subject: patch 7.0.214
Karsten Hopp 9f6c97
Fcc: outbox
Karsten Hopp 9f6c97
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 9f6c97
Mime-Version: 1.0
Karsten Hopp 9f6c97
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 9f6c97
Content-Transfer-Encoding: 8bit
Karsten Hopp 9f6c97
------------
Karsten Hopp 9f6c97
Karsten Hopp 9f6c97
Patch 7.0.214
Karsten Hopp 9f6c97
Problem:    When using <f-args> in a user command it's not possible to have an
Karsten Hopp 9f6c97
	    argument end in '\ '.
Karsten Hopp 9f6c97
Solution:   Change the handling of backslashes. (Yakov Lerner)
Karsten Hopp 9f6c97
Files:	    runtime/doc/map.txt, src/ex_docmd.c
Karsten Hopp 9f6c97
Karsten Hopp 9f6c97
Karsten Hopp 9f6c97
--- vim70/runtime/doc/map.txt.214	2006-09-08 23:26:31.000000000 +0200
Karsten Hopp 9f6c97
+++ runtime/doc/map.txt	2007-03-30 11:54:36.000000000 +0200
Karsten Hopp 9f6c97
@@ -1,4 +1,4 @@
Karsten Hopp 9f6c97
-*map.txt*       For Vim version 7.0.  Last change: 2006 Sep 05
Karsten Hopp 9f6c97
+*map.txt*       For Vim version 7.0.  Last change: 2007 Mar 08
Karsten Hopp 9f6c97
 
Karsten Hopp 9f6c97
 
Karsten Hopp 9f6c97
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
Karsten Hopp 9f6c97
@@ -1312,6 +1312,22 @@
Karsten Hopp 9f6c97
 arguments at spaces and Tabs, quotes each argument individually, and the
Karsten Hopp 9f6c97
 <f-args> sequence is replaced by the comma-separated list of quoted arguments.
Karsten Hopp 9f6c97
 See the Mycmd example below.  If no arguments are given <f-args> is removed.
Karsten Hopp 9f6c97
+    To embed whitespace into an argument of <f-args>, prepend a backslash.
Karsten Hopp 9f6c97
+ <f-args> replaces every pair of backslashes (\\) with one backslash.  A
Karsten Hopp 9f6c97
+ backslash followed by a character other than white space or a backslash
Karsten Hopp 9f6c97
+ remains unmodified.  Overview:
Karsten Hopp 9f6c97
+
Karsten Hopp 9f6c97
+       command            <f-args> ~
Karsten Hopp 9f6c97
+       XX ab              'ab'
Karsten Hopp 9f6c97
+       XX a\b             'a\b'
Karsten Hopp 9f6c97
+       XX a\ b            'a b'
Karsten Hopp 9f6c97
+       XX a\  b           'a ', 'b'
Karsten Hopp 9f6c97
+       XX a\\b            'a\b'
Karsten Hopp 9f6c97
+       XX a\\ b           'a\', 'b'
Karsten Hopp 9f6c97
+       XX a\\\b           'a\\b'
Karsten Hopp 9f6c97
+       XX a\\\ b          'a\ b'
Karsten Hopp 9f6c97
+       XX a\\\\b          'a\\b'
Karsten Hopp 9f6c97
+       XX a\\\\ b         'a\\', 'b'
Karsten Hopp 9f6c97
 
Karsten Hopp 9f6c97
 Examples >
Karsten Hopp 9f6c97
 
Karsten Hopp 9f6c97
*** ../vim-7.0.213/src/ex_docmd.c	Tue Nov 28 21:41:19 2006
Karsten Hopp 9f6c97
--- src/ex_docmd.c	Thu Mar  8 17:49:11 2007
Karsten Hopp 9f6c97
***************
Karsten Hopp 9f6c97
*** 5551,5556 ****
Karsten Hopp 9f6c97
--- 5551,5559 ----
Karsten Hopp 9f6c97
  	mch_memmove(cmd, cmd + 1, (gap->ga_len - i) * sizeof(ucmd_T));
Karsten Hopp 9f6c97
  }
Karsten Hopp 9f6c97
  
Karsten Hopp 9f6c97
+ /*
Karsten Hopp 9f6c97
+  * split and quote args for <f-args>
Karsten Hopp 9f6c97
+  */
Karsten Hopp 9f6c97
      static char_u *
Karsten Hopp 9f6c97
  uc_split_args(arg, lenp)
Karsten Hopp 9f6c97
      char_u *arg;
Karsten Hopp 9f6c97
***************
Karsten Hopp 9f6c97
*** 5567,5573 ****
Karsten Hopp 9f6c97
  
Karsten Hopp 9f6c97
      while (*p)
Karsten Hopp 9f6c97
      {
Karsten Hopp 9f6c97
! 	if (p[0] == '\\' && vim_iswhite(p[1]))
Karsten Hopp 9f6c97
  	{
Karsten Hopp 9f6c97
  	    len += 1;
Karsten Hopp 9f6c97
  	    p += 2;
Karsten Hopp 9f6c97
--- 5570,5581 ----
Karsten Hopp 9f6c97
  
Karsten Hopp 9f6c97
      while (*p)
Karsten Hopp 9f6c97
      {
Karsten Hopp 9f6c97
! 	if (p[0] == '\\' && p[1] == '\\')
Karsten Hopp 9f6c97
! 	{
Karsten Hopp 9f6c97
! 	    len += 2;
Karsten Hopp 9f6c97
! 	    p += 2;
Karsten Hopp 9f6c97
! 	}
Karsten Hopp 9f6c97
! 	else if (p[0] == '\\' && vim_iswhite(p[1]))
Karsten Hopp 9f6c97
  	{
Karsten Hopp 9f6c97
  	    len += 1;
Karsten Hopp 9f6c97
  	    p += 2;
Karsten Hopp 9f6c97
***************
Karsten Hopp 9f6c97
*** 5603,5609 ****
Karsten Hopp 9f6c97
      *q++ = '"';
Karsten Hopp 9f6c97
      while (*p)
Karsten Hopp 9f6c97
      {
Karsten Hopp 9f6c97
! 	if (p[0] == '\\' && vim_iswhite(p[1]))
Karsten Hopp 9f6c97
  	{
Karsten Hopp 9f6c97
  	    *q++ = p[1];
Karsten Hopp 9f6c97
  	    p += 2;
Karsten Hopp 9f6c97
--- 5611,5623 ----
Karsten Hopp 9f6c97
      *q++ = '"';
Karsten Hopp 9f6c97
      while (*p)
Karsten Hopp 9f6c97
      {
Karsten Hopp 9f6c97
! 	if (p[0] == '\\' && p[1] == '\\')
Karsten Hopp 9f6c97
! 	{
Karsten Hopp 9f6c97
! 	    *q++ = '\\';
Karsten Hopp 9f6c97
! 	    *q++ = '\\';
Karsten Hopp 9f6c97
! 	    p += 2;
Karsten Hopp 9f6c97
! 	}
Karsten Hopp 9f6c97
! 	else if (p[0] == '\\' && vim_iswhite(p[1]))
Karsten Hopp 9f6c97
  	{
Karsten Hopp 9f6c97
  	    *q++ = p[1];
Karsten Hopp 9f6c97
  	    p += 2;
Karsten Hopp 9f6c97
***************
Karsten Hopp 9f6c97
*** 5735,5741 ****
Karsten Hopp 9f6c97
  	    }
Karsten Hopp 9f6c97
  
Karsten Hopp 9f6c97
  	    break;
Karsten Hopp 9f6c97
! 	case 2: /* Quote and split */
Karsten Hopp 9f6c97
  	    /* This is hard, so only do it once, and cache the result */
Karsten Hopp 9f6c97
  	    if (*split_buf == NULL)
Karsten Hopp 9f6c97
  		*split_buf = uc_split_args(eap->arg, split_len);
Karsten Hopp 9f6c97
--- 5749,5755 ----
Karsten Hopp 9f6c97
  	    }
Karsten Hopp 9f6c97
  
Karsten Hopp 9f6c97
  	    break;
Karsten Hopp 9f6c97
! 	case 2: /* Quote and split (<f-args>) */
Karsten Hopp 9f6c97
  	    /* This is hard, so only do it once, and cache the result */
Karsten Hopp 9f6c97
  	    if (*split_buf == NULL)
Karsten Hopp 9f6c97
  		*split_buf = uc_split_args(eap->arg, split_len);
Karsten Hopp 9f6c97
*** ../vim-7.0.213/src/version.c	Thu Mar  8 14:54:52 2007
Karsten Hopp 9f6c97
--- src/version.c	Thu Mar  8 18:11:47 2007
Karsten Hopp 9f6c97
***************
Karsten Hopp 9f6c97
*** 668,669 ****
Karsten Hopp 9f6c97
--- 668,671 ----
Karsten Hopp 9f6c97
  {   /* Add new patch number below this line */
Karsten Hopp 9f6c97
+ /**/
Karsten Hopp 9f6c97
+     214,
Karsten Hopp 9f6c97
  /**/
Karsten Hopp 9f6c97
Karsten Hopp 9f6c97
-- 
Karsten Hopp 9f6c97
Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
Karsten Hopp 9f6c97
"Embrace and extend"...?
Karsten Hopp 9f6c97
Karsten Hopp 9f6c97
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 9f6c97
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 9f6c97
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 9f6c97
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///