On Sun, Aug 19, 2007 at 05:52:56PM +0200, Bram Moolenaar wrote: > My proposal is that you fix it :-) We have mch_has_wildcard(), but it > applies to a whole string, so you need to do some more work.
Okidoki :-)
I'm sorry to be slow, but my parents suddenly decided to pay me a visit,
and you don't say no to a free meal :-) (they brought it with them...)
Here is a patch for the problem. Everybody on the list is very welcome
to test it and comment on it!
I had to cheat a bit with regard to ']', as we want to be able to
':e [a-z]<Tab>' etc., and mch_has_wildcard("]") returns false.
Thanks to Yegappan Lakshmanan for reporting the bug.
Martin
Index: src/ex_docmd.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/ex_docmd.c,v
retrieving revision 1.131
diff -c -r1.131 ex_docmd.c
*** src/ex_docmd.c 18 Aug 2007 15:47:10 -0000 1.131
--- src/ex_docmd.c 19 Aug 2007 18:27:38 -0000
***************
*** 3282,3287 ****
--- 3282,3288 ----
if (ea.argt & XFILE)
{
int c;
+ char_u char_save;
int in_quote = FALSE;
char_u *bow = NULL; /* Beginning of word */
***************
*** 3316,3344 ****
else if (!vim_isfilec(c))
#endif
{
! while (*p != NUL)
{
#ifdef FEAT_MBYTE
! if (has_mbyte)
! c = mb_ptr2char(p);
! else
#endif
! c = *p;
! if (c == '`' || vim_isfilec(c))
! break;
#ifdef FEAT_MBYTE
! if (has_mbyte)
! len = (*mb_ptr2len)(p);
! else
#endif
! len = 1;
! mb_ptr_adv(p);
}
- if (in_quote)
- bow = p;
else
! xp->xp_pattern = p;
! p -= len;
}
mb_ptr_adv(p);
}
--- 3317,3365 ----
else if (!vim_isfilec(c))
#endif
{
! /* As mch_has_wildcard() works on a string, put in a NUL
! * temporarily. Check explicitly for ']', as it must be
! * interpreted as a wildcard here, and mch_has_wildcard("]")
! * returns false. */
! len = (*mb_ptr2len)(p);
! char_save = *(p + len);
! *(p + len) = NUL;
! if (c != ']' && !mch_has_wildcard(p))
{
+ *(p + len) = char_save;
+ while (*p != NUL)
+ {
#ifdef FEAT_MBYTE
! if (has_mbyte)
! c = mb_ptr2char(p);
! else
#endif
! c = *p;
! char_save = *(p + len);
! *(p + len) = NUL;
! if (c == '`' || c == ']' || vim_isfilec(c)
! || mch_has_wildcard(p))
! {
! *(p + len) = char_save;
! break;
! }
! *(p + len) = char_save;
#ifdef FEAT_MBYTE
! if (has_mbyte)
! len = (*mb_ptr2len)(p);
! else
#endif
! len = 1;
! mb_ptr_adv(p);
! }
! if (in_quote)
! bow = p;
! else
! xp->xp_pattern = p;
! p -= len;
}
else
! *(p + len) = char_save;
}
mb_ptr_adv(p);
}
signature.asc
Description: Digital signature
