mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
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:
@@ -1639,10 +1639,10 @@ int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, bool wig)
|
|||||||
|
|
||||||
if (wig) {
|
if (wig) {
|
||||||
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);
|
||||||
|
@@ -5264,7 +5264,7 @@ void ex_vimgrep(exarg_T *eap)
|
|||||||
qf_new_list(qi, title);
|
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) {
|
if (get_arglist_exp(p, &fcount, &fnames, true) == FAIL) {
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
@@ -2650,6 +2650,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()
|
||||||
|
Reference in New Issue
Block a user