[SCM] Vim packaging branch, maint/lenny, updated. debian/7.1.314-3-51-g209709e
James Vega
jamessan at debian.org
Sun Oct 12 06:29:41 UTC 2008
The following commit has been merged in the maint/lenny branch:
commit cb279e0979a103089695c21564ccc5bf8de5f558
Author: James Vega <jamessan at debian.org>
Date: Fri Oct 10 00:27:04 2008 -0400
[7.2.010] "K" in Visual mode does not properly escape all characters
Patch 7.2.010
Problem: When using "K" in Visual mode not all characters are properly
escaped. (Ben Schmidt)
Solution: Use a function with the functionality of shellescape(). (Jan
Minar)
Conflicts:
src/version.c
Signed-off-by: James Vega <jamessan at debian.org>
diff --git a/debian/README b/debian/README
index 0cb1d2d..4eb2a3f 100644
--- a/debian/README
+++ b/debian/README
@@ -352,3 +352,4 @@ Individual patches for Vim 7.1:
8321 7.2b.018 cmdline completion on shell cmd fails on file containing '!'
1783 7.2b.026 GTK 2 file chooser causes significant slowdown
3402 7.2c.002 fnameescape() doesn't handle a leading '+' or '>'
+ 5415 7.2.010 "K" in Visual mode does not properly escape all characters
diff --git a/src/mbyte.c b/src/mbyte.c
index 6ab73f2..1e1ef0f 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -2530,7 +2530,6 @@ utf_head_off(base, p)
return (int)(p - q);
}
-#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Copy a character from "*fp" to "*tp" and advance the pointers.
*/
@@ -2545,7 +2544,6 @@ mb_copy_char(fp, tp)
*tp += l;
*fp += l;
}
-#endif
/*
* Return the offset from "p" to the first byte of a character. When "p" is
diff --git a/src/misc2.c b/src/misc2.c
index 659a0ce..64649bc 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1260,7 +1260,6 @@ vim_strsave_escaped_ext(string, esc_chars, cc, bsl)
return escaped_string;
}
-#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
/*
* Return TRUE when 'shell' has "csh" in the tail.
*/
@@ -1269,9 +1268,7 @@ csh_like_shell()
{
return (strstr((char *)gettail(p_sh), "csh") != NULL);
}
-#endif
-#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Escape "string" for use as a shell argument with system().
* This uses single quotes, except when we know we need to use double qoutes
@@ -1394,7 +1391,6 @@ vim_strsave_shellescape(string, do_special)
return escaped_string;
}
-#endif
/*
* Like vim_strsave(), but make all characters uppercase.
diff --git a/src/normal.c b/src/normal.c
index d3ce6a8..99dff98 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -5434,6 +5434,11 @@ nv_ident(cap)
STRCPY(buf, "he! ");
else
{
+ /* An external command will probably use an argument starting
+ * with "-" as an option. To avoid trouble we skip the "-". */
+ while (*ptr == '-')
+ ++ptr;
+
/* When a count is given, turn it into a range. Is this
* really what we want? */
isman = (STRCMP(kp, "man") == 0);
@@ -5476,37 +5481,57 @@ nv_ident(cap)
/*
* Now grab the chars in the identifier
*/
- if (cmdchar == '*')
- aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
- else if (cmdchar == '#')
- aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
- else if (cmdchar == 'K' && !kp_help)
- aux_ptr = (char_u *)" \t\\\"|!";
+ if (cmdchar == 'K' && !kp_help)
+ {
+ /* Escape the argument properly for a shell command */
+ p = vim_strsave_shellescape(ptr, TRUE);
+ if (p == NULL)
+ {
+ vim_free(buf);
+ return;
+ }
+ buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
+ if (buf == NULL)
+ {
+ vim_free(buf);
+ vim_free(p);
+ return;
+ }
+ STRCAT(buf, p);
+ vim_free(p);
+ }
else
- /* Don't escape spaces and Tabs in a tag with a backslash */
- aux_ptr = (char_u *)"\\|\"";
-
- p = buf + STRLEN(buf);
- while (n-- > 0)
{
- /* put a backslash before \ and some others */
- if (vim_strchr(aux_ptr, *ptr) != NULL)
- *p++ = '\\';
-#ifdef FEAT_MBYTE
- /* When current byte is a part of multibyte character, copy all bytes
- * of that character. */
- if (has_mbyte)
+ if (cmdchar == '*')
+ aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
+ else if (cmdchar == '#')
+ aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
+ else
+ /* Don't escape spaces and Tabs in a tag with a backslash */
+ aux_ptr = (char_u *)"\\|\"\n*?[";
+
+ p = buf + STRLEN(buf);
+ while (n-- > 0)
{
- int i;
- int len = (*mb_ptr2len)(ptr) - 1;
+ /* put a backslash before \ and some others */
+ if (vim_strchr(aux_ptr, *ptr) != NULL)
+ *p++ = '\\';
+#ifdef FEAT_MBYTE
+ /* When current byte is a part of multibyte character, copy all
+ * bytes of that character. */
+ if (has_mbyte)
+ {
+ int i;
+ int len = (*mb_ptr2len)(ptr) - 1;
- for (i = 0; i < len && n >= 1; ++i, --n)
- *p++ = *ptr++;
- }
+ for (i = 0; i < len && n >= 1; ++i, --n)
+ *p++ = *ptr++;
+ }
#endif
- *p++ = *ptr++;
+ *p++ = *ptr++;
+ }
+ *p = NUL;
}
- *p = NUL;
/*
* Execute the command.
--
Vim packaging
More information about the pkg-vim-maintainers
mailing list