4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When using "K" in Visual mode not all characters are properly
12 escaped. (Ben Schmidt)
13 Solution: Use a function with the functionality of shellescape(). (Jan
15 Files: src/mbyte.c, src/misc2.c, src/normal.c
18 *** ../vim-7.2.009/src/mbyte.c Wed Aug 6 18:45:36 2008
19 --- src/mbyte.c Wed Sep 3 22:34:48 2008
25 - #if defined(FEAT_EVAL) || defined(PROTO)
27 * Copy a character from "*fp" to "*tp" and advance the pointers.
38 * Return the offset from "p" to the first byte of a character. When "p" is
40 *** ../vim-7.2.009/src/misc2.c Thu Jul 24 20:28:58 2008
41 --- src/misc2.c Wed Sep 3 22:05:21 2008
44 return escaped_string;
47 - #if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
49 * Return TRUE when 'shell' has "csh" in the tail.
55 return (strstr((char *)gettail(p_sh), "csh") != NULL);
59 - #if defined(FEAT_EVAL) || defined(PROTO)
61 * Escape "string" for use as a shell argument with system().
62 * This uses single quotes, except when we know we need to use double qoutes
67 return escaped_string;
72 * Like vim_strsave(), but make all characters uppercase.
74 *** ../vim-7.2.009/src/normal.c Thu Jul 31 22:03:54 2008
75 --- src/normal.c Sat Sep 6 15:06:07 2008
82 + /* An external command will probably use an argument starting
83 + * with "-" as an option. To avoid trouble we skip the "-". */
87 /* When a count is given, turn it into a range. Is this
88 * really what we want? */
89 isman = (STRCMP(kp, "man") == 0);
93 * Now grab the chars in the identifier
96 ! aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
97 ! else if (cmdchar == '#')
98 ! aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
99 ! else if (cmdchar == 'K' && !kp_help)
100 ! aux_ptr = (char_u *)" \t\\\"|!";
102 ! /* Don't escape spaces and Tabs in a tag with a backslash */
103 ! aux_ptr = (char_u *)"\\|\"";
105 ! p = buf + STRLEN(buf);
108 ! /* put a backslash before \ and some others */
109 ! if (vim_strchr(aux_ptr, *ptr) != NULL)
112 ! /* When current byte is a part of multibyte character, copy all bytes
113 ! * of that character. */
117 ! int len = (*mb_ptr2len)(ptr) - 1;
119 ! for (i = 0; i < len && n >= 1; ++i, --n)
128 * Execute the command.
131 * Now grab the chars in the identifier
133 ! if (cmdchar == 'K' && !kp_help)
135 ! /* Escape the argument properly for a shell command */
136 ! p = vim_strsave_shellescape(ptr, TRUE);
142 + buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
154 + if (cmdchar == '*')
155 + aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
156 + else if (cmdchar == '#')
157 + aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
159 + /* Don't escape spaces and Tabs in a tag with a backslash */
160 + aux_ptr = (char_u *)"\\|\"\n*?[";
162 + p = buf + STRLEN(buf);
165 + /* put a backslash before \ and some others */
166 + if (vim_strchr(aux_ptr, *ptr) != NULL)
169 + /* When current byte is a part of multibyte character, copy all
170 + * bytes of that character. */
174 + int len = (*mb_ptr2len)(ptr) - 1;
176 + for (i = 0; i < len && n >= 1; ++i, --n)
186 * Execute the command.
187 *** ../vim-7.2.009/src/version.c Mon Sep 1 17:56:05 2008
188 --- src/version.c Sat Sep 6 16:26:42 2008
192 { /* Add new patch number below this line */
198 Q. What happens to programmers when they die?
199 A: MS-Windows programmers are reinstalled. C++ programmers become undefined,
200 anyone who refers to them will die as well. Java programmers reincarnate
201 after being garbage collected.
203 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
204 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
205 \\\ download, build and distribute -- http://www.A-A-P.org ///
206 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///