0
0
mirror of https://github.com/vim/vim.git synced 2025-10-05 05:34:07 -04:00

Fix completion of file names with '%' and '*'.

This commit is contained in:
Bram Moolenaar
2010-06-01 21:57:09 +02:00
parent 83d09bb85e
commit 8cd213c09a
5 changed files with 156 additions and 4 deletions

View File

@@ -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++] = '*';