aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-31 10:10:22 -0500
committerGitHub <noreply@github.com>2021-01-31 10:10:22 -0500
commitb2713f11b48fe8029aeae07ef6a55ef182a4fbfd (patch)
tree59df6354711c50a01c4c24549793bdcf07fa4d1e /src
parent55add1c1c8a9a040f02a880096ca153f7db3e501 (diff)
downloadrneovim-b2713f11b48fe8029aeae07ef6a55ef182a4fbfd.tar.gz
rneovim-b2713f11b48fe8029aeae07ef6a55ef182a4fbfd.tar.bz2
rneovim-b2713f11b48fe8029aeae07ef6a55ef182a4fbfd.zip
vim-patch:8.2.2430: :vimgrep expands wildcards twice (#13853)
Problem: :vimgrep expands wildcards twice. Solution: Do not expand wildcards a second time. https://github.com/vim/vim/commit/f8c6a1718007432812184c28495e8d27ee6c0395
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds2.c4
-rw-r--r--src/nvim/quickfix.c2
-rw-r--r--src/nvim/testdir/test_quickfix.vim7
3 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index c400975108..e49bb99aa0 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -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);
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index a625c09f78..3d639d7db5 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -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;
}
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 00a253a215..704fdacdcd 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -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()