forked from aniani/vim
Fix completion of file names with '%' and '*'.
This commit is contained in:
@@ -208,7 +208,7 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes
|
||||
|
||||
!include <Win32.mak>
|
||||
|
||||
# May turn on Win64 compatibility warnings for VC7.x and VC8.
|
||||
# Flag to turn on Win64 compatibility warnings for VC7.x and VC8.
|
||||
WP64CHECK = /Wp64
|
||||
|
||||
#>>>>> path of the compiler and linker; name of include and lib directories
|
||||
|
||||
@@ -4091,6 +4091,7 @@ addstar(fname, len, context)
|
||||
int i, j;
|
||||
int new_len;
|
||||
char_u *tail;
|
||||
int ends_in_star;
|
||||
|
||||
if (context != EXPAND_FILES
|
||||
&& context != EXPAND_SHELLCMD
|
||||
@@ -4181,8 +4182,17 @@ addstar(fname, len, context)
|
||||
* When the name ends in '$' don't add a star, remove the '$'.
|
||||
*/
|
||||
tail = gettail(retval);
|
||||
ends_in_star = (len > 0 && retval[len - 1] == '*');
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
for (i = len - 2; i >= 0; --i)
|
||||
{
|
||||
if (retval[i] != '\\')
|
||||
break;
|
||||
ends_in_star = !ends_in_star;
|
||||
}
|
||||
#endif
|
||||
if ((*retval != '~' || tail != retval)
|
||||
&& (len == 0 || retval[len - 1] != '*')
|
||||
&& !ends_in_star
|
||||
&& vim_strchr(tail, '$') == NULL
|
||||
&& vim_strchr(retval, '`') == NULL)
|
||||
retval[len++] = '*';
|
||||
|
||||
11
src/fileio.c
11
src/fileio.c
@@ -10189,6 +10189,13 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Undo escaping from ExpandEscape():
|
||||
* foo\?bar -> foo?bar
|
||||
* foo\%bar -> foo%bar
|
||||
* foo\,bar -> foo,bar
|
||||
* foo\ bar -> foo bar
|
||||
* Don't unescape \, * and others that are also special in a
|
||||
* regexp. */
|
||||
if (*++p == '?'
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
&& no_bslash
|
||||
@@ -10196,8 +10203,8 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash)
|
||||
)
|
||||
reg_pat[i++] = '?';
|
||||
else
|
||||
if (*p == ',')
|
||||
reg_pat[i++] = ',';
|
||||
if (*p == ',' || *p == '%' || *p == '#' || *p == ' ')
|
||||
reg_pat[i++] = *p;
|
||||
else
|
||||
{
|
||||
if (allow_dirs != NULL && vim_ispathsep(*p)
|
||||
|
||||
Reference in New Issue
Block a user