diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-06-01 21:57:09 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-06-01 21:57:09 +0200 |
commit | 8cd213c09a3598834888d81deb45ff17e6654a86 (patch) | |
tree | 867353b3474346210f6de33ad2b5b01936a4460d /src/ex_getln.c | |
parent | 83d09bb85e471135222f79b15de549f435e73fae (diff) | |
download | vim-git-8cd213c09a3598834888d81deb45ff17e6654a86.tar.gz |
Fix completion of file names with '%' and '*'.
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 6e74a23f1..e8b6f7c4d 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -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++] = '*'; |