1
0
forked from aniani/vim

patch 8.2.2430: :vimgrep expands wildcards twice

Problem:    :vimgrep expands wildcards twice.
Solution:   Do not expand wildcards a second time.
This commit is contained in:
Bram Moolenaar
2021-01-30 18:09:06 +01:00
parent 59ff64079b
commit f8c6a17180
4 changed files with 12 additions and 3 deletions

View File

@@ -315,10 +315,10 @@ get_arglist_exp(
return FAIL; return FAIL;
if (wig == TRUE) if (wig == TRUE)
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data, i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
fcountp, fnamesp, EW_FILE|EW_NOTFOUND); fcountp, fnamesp, EW_FILE|EW_NOTFOUND|EW_NOTWILD);
else else
i = gen_expand_wildcards(ga.ga_len, (char_u **)ga.ga_data, i = gen_expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
fcountp, fnamesp, EW_FILE|EW_NOTFOUND); fcountp, fnamesp, EW_FILE|EW_NOTFOUND|EW_NOTWILD);
ga_clear(&ga); ga_clear(&ga);
return i; return i;

View File

@@ -6053,7 +6053,7 @@ vgr_process_args(
return FAIL; return FAIL;
} }
// parse the list of arguments // Parse the list of arguments, wildcards have already been expanded.
if (get_arglist_exp(p, &args->fcount, &args->fnames, TRUE) == FAIL) if (get_arglist_exp(p, &args->fcount, &args->fnames, TRUE) == FAIL)
return FAIL; return FAIL;
if (args->fcount == 0) if (args->fcount == 0)

View File

@@ -2865,6 +2865,13 @@ func Test_vimgrep()
call XvimgrepTests('l') call XvimgrepTests('l')
endfunc endfunc
func Test_vimgrep_wildcards_expanded_once()
new X[id-01] file.txt
call setline(1, 'some text to search for')
vimgrep text %
bwipe!
endfunc
" Test for incsearch highlighting of the :vimgrep pattern " Test for incsearch highlighting of the :vimgrep pattern
" This test used to cause "E315: ml_get: invalid lnum" errors. " This test used to cause "E315: ml_get: invalid lnum" errors.
func Test_vimgrep_incsearch() func Test_vimgrep_incsearch()

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2430,
/**/ /**/
2429, 2429,
/**/ /**/