[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:19 UTC 2008
The following commit has been merged in the maint/lenny branch:
commit c25bebbb793aec2a03815c835756f8fa0c8767c0
Author: James Vega <jamessan at debian.org>
Date: Thu Oct 9 23:54:40 2008 -0400
[7.2b.018] cmdline completion on shell cmd fails on file containing '!'
Patch 7.2b.018
Problem: When doing command line completion on a file name for a csh-like
shell argument a '!' character isn't escaped properly.
Solution: Add another backslash.
Conflicts:
src/ex_getln.c
src/screen.c
src/version.c
Signed-off-by: James Vega <jamessan at debian.org>
diff --git a/debian/README b/debian/README
index b8c55f4..0cb1d2d 100644
--- a/debian/README
+++ b/debian/README
@@ -349,5 +349,6 @@ Individual patches for Vim 7.1:
1915 7.1.314 'pastetoggle' is written to the session file without escaping
20111 7.2a.013 shellescape() does not escape "%" and "#" characters
3465 7.2b.005 shellescape() doesn't take care of "!" and "\n"
+ 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 '>'
diff --git a/src/ex_getln.c b/src/ex_getln.c
index e039d8e..d80861c 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -3708,10 +3708,10 @@ vim_strsave_fnameescape(fname, shell)
char_u *fname;
int shell;
{
+ char_u *p;
#ifdef BACKSLASH_IN_FILENAME
char_u buf[20];
int j = 0;
- char_u *p;
/* Don't escape '[' and '{' if they are in 'isfname'. */
for (p = PATH_ESC_CHARS; *p != NUL; ++p)
@@ -3731,6 +3731,7 @@ vim_strsave_fnameescape(fname, shell)
vim_free(p);
p = s;
}
+ return p;
#endif
/* '>' and '+' are special at the start of some commands, e.g. ":edit" and
diff --git a/src/misc2.c b/src/misc2.c
index 6712f38..659a0ce 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1260,6 +1260,17 @@ 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.
+ */
+ int
+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().
@@ -1286,7 +1297,7 @@ vim_strsave_shellescape(string, do_special)
* the like we must not put a backslash before it, it will be taken
* literally. If do_special is set the '!' will be escaped twice.
* Csh also needs to have "\n" escaped twice when do_special is set. */
- csh_like = (strstr((char *)gettail(p_sh), "csh") != NULL);
+ csh_like = csh_like_shell();
/* First count the number of extra bytes required. */
length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */
diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro
index 8574835..05fc65c 100644
--- a/src/proto/misc2.pro
+++ b/src/proto/misc2.pro
@@ -29,6 +29,7 @@ char_u *vim_strsave __ARGS((char_u *string));
char_u *vim_strnsave __ARGS((char_u *string, int len));
char_u *vim_strsave_escaped __ARGS((char_u *string, char_u *esc_chars));
char_u *vim_strsave_escaped_ext __ARGS((char_u *string, char_u *esc_chars, int cc, int bsl));
+int csh_like_shell __ARGS((void));
char_u *vim_strsave_shellescape __ARGS((char_u *string, int do_special));
char_u *vim_strsave_up __ARGS((char_u *string));
char_u *vim_strnsave_up __ARGS((char_u *string, int len));
diff --git a/src/screen.c b/src/screen.c
index 3a585ff..42320f5 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -5445,8 +5445,7 @@ status_match_len(xp, s)
while (*s != NUL)
{
- if (skip_status_match_char(xp, s))
- ++s;
+ s += skip_status_match_char(xp, s);
len += ptr2cells(s);
mb_ptr_adv(s);
}
@@ -5455,7 +5454,7 @@ status_match_len(xp, s)
}
/*
- * Return TRUE for characters that are not displayed in a status match.
+ * Return the number of characters that should be skipped in a status match.
* These are backslashes used for escaping. Do show backslashes in help tags.
*/
static int
@@ -5463,13 +5462,21 @@ skip_status_match_char(xp, s)
expand_T *xp;
char_u *s;
{
- return ((rem_backslash(s) && xp->xp_context != EXPAND_HELP)
+ if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP)
#ifdef FEAT_MENU
|| ((xp->xp_context == EXPAND_MENUS
|| xp->xp_context == EXPAND_MENUNAMES)
&& (s[0] == '\t' || (s[0] == '\\' && s[1] != NUL)))
#endif
- );
+ )
+ {
+#ifndef BACKSLASH_IN_FILENAME
+ if (xp->xp_shell && csh_like_shell() && s[1] == '\\' && s[2] == '!')
+ return 2;
+#endif
+ return 1;
+ }
+ return 0;
}
/*
@@ -5607,8 +5614,7 @@ win_redr_status_matches(xp, num_matches, matches, match, showtail)
#endif
for ( ; *s != NUL; ++s)
{
- if (skip_status_match_char(xp, s))
- ++s;
+ s += skip_status_match_char(xp, s);
clen += ptr2cells(s);
#ifdef FEAT_MBYTE
if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1)
--
Vim packaging
More information about the pkg-vim-maintainers
mailing list