]> granicus.if.org Git - vim/commitdiff
updated for version 7.0-214 v7.0.214
authorBram Moolenaar <Bram@vim.org>
Thu, 8 Mar 2007 17:12:08 +0000 (17:12 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 8 Mar 2007 17:12:08 +0000 (17:12 +0000)
runtime/doc/map.txt
src/ex_docmd.c
src/version.c

index 62515cc61544461351a01080c399c2320ffdf1fb..d81bc3f0107f386829349a58d51113aacb8943d2 100644 (file)
@@ -1,4 +1,4 @@
-*map.txt*       For Vim version 7.0.  Last change: 2006 May 03
+*map.txt*       For Vim version 7.0.  Last change: 2007 Mar 08
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1303,12 +1303,28 @@ If the first two characters of an escape sequence are "q-" (for example,
 <q-args>) then the value is quoted in such a way as to make it a valid value
 for use in an expression.  This uses the argument as one single value.
 When there is no argument <q-args> is an empty string.
-
+                                                       *<f-args>*
 To allow commands to pass their arguments on to a user-defined function, there
 is a special form <f-args> ("function args").  This splits the command
 arguments at spaces and Tabs, quotes each argument individually, and the
 <f-args> sequence is replaced by the comma-separated list of quoted arguments.
 See the Mycmd example below.  If no arguments are given <f-args> is removed.
+   To embed whitespace into an argument of <f-args>, prepend a backslash.
+<f-args> replaces every pair of backslashes (\\) with one backslash.  A
+backslash followed by a character other than white space or a backslash
+remains unmodified.  Overview:
+
+       command            <f-args> ~
+       XX ab              'ab'
+       XX a\b             'a\b'
+       XX a\ b            'a b'
+       XX a\  b           'a ', 'b'
+       XX a\\b            'a\b'
+       XX a\\ b           'a\', 'b'
+       XX a\\\b           'a\\b'
+       XX a\\\ b          'a\ b'
+       XX a\\\\b          'a\\b'
+       XX a\\\\ b         'a\\', 'b'
 
 Examples >
 
index 7f136f19a7a156526d9e65ae1a122a130422512a..1152a18a73f3b9bd00360194fce5c7abd436bda2 100644 (file)
@@ -5551,6 +5551,9 @@ ex_delcommand(eap)
        mch_memmove(cmd, cmd + 1, (gap->ga_len - i) * sizeof(ucmd_T));
 }
 
+/*
+ * split and quote args for <f-args>
+ */
     static char_u *
 uc_split_args(arg, lenp)
     char_u *arg;
@@ -5567,7 +5570,12 @@ uc_split_args(arg, lenp)
 
     while (*p)
     {
-       if (p[0] == '\\' && vim_iswhite(p[1]))
+       if (p[0] == '\\' && p[1] == '\\')
+       {
+           len += 2;
+           p += 2;
+       }
+       else if (p[0] == '\\' && vim_iswhite(p[1]))
        {
            len += 1;
            p += 2;
@@ -5603,7 +5611,13 @@ uc_split_args(arg, lenp)
     *q++ = '"';
     while (*p)
     {
-       if (p[0] == '\\' && vim_iswhite(p[1]))
+       if (p[0] == '\\' && p[1] == '\\')
+       {
+           *q++ = '\\';
+           *q++ = '\\';
+           p += 2;
+       }
+       else if (p[0] == '\\' && vim_iswhite(p[1]))
        {
            *q++ = p[1];
            p += 2;
@@ -5735,7 +5749,7 @@ uc_check_code(code, len, buf, cmd, eap, split_buf, split_len)
            }
 
            break;
-       case 2: /* Quote and split */
+       case 2: /* Quote and split (<f-args>) */
            /* This is hard, so only do it once, and cache the result */
            if (*split_buf == NULL)
                *split_buf = uc_split_args(eap->arg, split_len);
index f8593316f6cfbf2c9f50b1bcfaa918f38673b506..6c4c641f10b254ad421cc9ab7136dce18c9548cd 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    214,
 /**/
     213,
 /**/