| # KH: Modified for runtime update |
| To: vim-dev@vim.org |
| Subject: patch 7.0.214 |
| 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.0.214 |
| Problem: When using <f-args> in a user command it's not possible to have an |
| argument end in '\ '. |
| Solution: Change the handling of backslashes. (Yakov Lerner) |
| Files: runtime/doc/map.txt, src/ex_docmd.c |
| |
| |
| |
| |
| @@ -1,4 +1,4 @@ |
| -*map.txt* For Vim version 7.0. Last change: 2006 Sep 05 |
| +*map.txt* For Vim version 7.0. Last change: 2007 Mar 08 |
| |
| |
| VIM REFERENCE MANUAL by Bram Moolenaar |
| @@ -1312,6 +1312,22 @@ |
| 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 > |
| |
| |
| |
| |
| *** 5551,5556 **** |
| --- 5551,5559 ---- |
| 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,5573 **** |
| |
| while (*p) |
| { |
| ! if (p[0] == '\\' && vim_iswhite(p[1])) |
| { |
| len += 1; |
| p += 2; |
| --- 5570,5581 ---- |
| |
| while (*p) |
| { |
| ! if (p[0] == '\\' && p[1] == '\\') |
| ! { |
| ! len += 2; |
| ! p += 2; |
| ! } |
| ! else if (p[0] == '\\' && vim_iswhite(p[1])) |
| { |
| len += 1; |
| p += 2; |
| |
| *** 5603,5609 **** |
| *q++ = '"'; |
| while (*p) |
| { |
| ! if (p[0] == '\\' && vim_iswhite(p[1])) |
| { |
| *q++ = p[1]; |
| p += 2; |
| --- 5611,5623 ---- |
| *q++ = '"'; |
| while (*p) |
| { |
| ! if (p[0] == '\\' && p[1] == '\\') |
| ! { |
| ! *q++ = '\\'; |
| ! *q++ = '\\'; |
| ! p += 2; |
| ! } |
| ! else if (p[0] == '\\' && vim_iswhite(p[1])) |
| { |
| *q++ = p[1]; |
| p += 2; |
| |
| *** 5735,5741 **** |
| } |
| |
| break; |
| ! case 2: /* Quote and split */ |
| /* 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); |
| --- 5749,5755 ---- |
| } |
| |
| break; |
| ! 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); |
| |
| |
| |
| *** 668,669 **** |
| --- 668,671 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 214, |
| /**/ |
| |
| -- |
| Microsoft's definition of a boolean: TRUE, FALSE, MAYBE |
| "Embrace and extend"...? |
| |
| /// 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 /// |