Skip to content

Commit f8c6a17

Browse files
committed
patch 8.2.2430: :vimgrep expands wildcards twice
Problem: :vimgrep expands wildcards twice. Solution: Do not expand wildcards a second time.
1 parent 59ff640 commit f8c6a17

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/arglist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ get_arglist_exp(
315315
return FAIL;
316316
if (wig == TRUE)
317317
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
318-
fcountp, fnamesp, EW_FILE|EW_NOTFOUND);
318+
fcountp, fnamesp, EW_FILE|EW_NOTFOUND|EW_NOTWILD);
319319
else
320320
i = gen_expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
321-
fcountp, fnamesp, EW_FILE|EW_NOTFOUND);
321+
fcountp, fnamesp, EW_FILE|EW_NOTFOUND|EW_NOTWILD);
322322

323323
ga_clear(&ga);
324324
return i;

src/quickfix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6053,7 +6053,7 @@ vgr_process_args(
60536053
return FAIL;
60546054
}
60556055

6056-
// parse the list of arguments
6056+
// Parse the list of arguments, wildcards have already been expanded.
60576057
if (get_arglist_exp(p, &args->fcount, &args->fnames, TRUE) == FAIL)
60586058
return FAIL;
60596059
if (args->fcount == 0)

src/testdir/test_quickfix.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,6 +2865,13 @@ func Test_vimgrep()
28652865
call XvimgrepTests('l')
28662866
endfunc
28672867

2868+
func Test_vimgrep_wildcards_expanded_once()
2869+
new X[id-01] file.txt
2870+
call setline(1, 'some text to search for')
2871+
vimgrep text %
2872+
bwipe!
2873+
endfunc
2874+
28682875
" Test for incsearch highlighting of the :vimgrep pattern
28692876
" This test used to cause "E315: ml_get: invalid lnum" errors.
28702877
func Test_vimgrep_incsearch()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2430,
753755
/**/
754756
2429,
755757
/**/

0 commit comments

Comments
 (0)