> > :echo expand("/a/b/c 'd")
> > :echo glob("a 'b/*")
> Both seem to work fine for me. Maybe you'd have to tell more about
> your environment & check if this also occurs when running vanilla vim
> (no plugins, no (g)vimrc).
You are using Windows, right ?
I checked the source and what is happening for Unix is (for expand):
Call stack is roughly like this:
ExpandOne -> expand_wildcards -> gen_expand_wildcards
============================ os_unix.h:541 =============================
#define SPECIAL_WILDCHAR "`'{"
========================================================================
============================= misc1.c:9477 =============================
for (i = 0; i < num_pat; i++)
{
if (vim_strpbrk(pat[i], (char_u *)SPECIAL_WILDCHAR) != NULL
# ifdef VIM_BACKTICK
&& !(vim_backtick(pat[i]) && pat[i][1] == '=')
# endif
) {
return mch_expand_wildcards(num_pat, pat, num_file, file, flags);
}
}
========================================================================
for expand("/a/b/c 'd") we go to mch_expand_wildcards for expand("/a/b/c d"),
we continue running gen_expand_wildcards
If I follow mch_expand_wildcards, it gets to
============================ os_unix.c:6652 ============================
/* file names are separated with Space */
if (shell_style == STYLE_ECHO)
{
buffer[len] = '\n'; /* make sure the buffer ends in NL */
p = buffer;
for (i = 0; *p != '\n'; ++i) /* count number of entries */
{
while (*p != ' ' && *p != '\n')
++p;
p = skipwhite(p); /* skip to next entry */
}
}
========================================================================
and since the string was "/a/b/c 'd" it's separated to two files -
/a/b/c and 'd
If I'm right with my investigation, I feel that the result is wrong. If
there is really file called "/a/b/c 'd" expand should return "/a/b/c 'd"
as one string.
Thanks
--
Vlad
pgp1L4asnzPwE.pgp
Description: PGP signature
