vim-patch:8.2.2430: :vimgrep expands wildcards twice (#13853)

Problem:    :vimgrep expands wildcards twice.
Solution:   Do not expand wildcards a second time.
f8c6a17180
This commit is contained in:
Jan Edmund Lazo 2021-01-31 10:10:22 -05:00 committed by GitHub
parent 55add1c1c8
commit b2713f11b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -1639,10 +1639,10 @@ int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, bool wig)
if (wig) {
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 {
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);

View File

@ -5264,7 +5264,7 @@ void ex_vimgrep(exarg_T *eap)
qf_new_list(qi, title);
}
// parse the list of arguments
// Parse the list of arguments, wildcards have already been expanded.
if (get_arglist_exp(p, &fcount, &fnames, true) == FAIL) {
goto theend;
}

View File

@ -2650,6 +2650,13 @@ func Test_vimgrep()
call XvimgrepTests('l')
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
" This test used to cause "E315: ml_get: invalid lnum" errors.
func Test_vimgrep_incsearch()