]> granicus.if.org Git - vim/commitdiff
patch 8.2.3713: MS-Windows: no error if vimgrep pattern is not matching v8.2.3713
authorChristian Brabandt <cb@256bit.org>
Wed, 1 Dec 2021 10:54:24 +0000 (10:54 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 1 Dec 2021 10:54:24 +0000 (10:54 +0000)
Problem:    MS-Windows: No error message if vimgrep pattern is not matching.
Solution:   Give an error message. (Christian Brabandt, closes #9245,
            closes #8762)

src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index 4405d4b64bb671ca3ec0ec43d082b9a72d7a6f05..d7c0a88a62b15b6b2cc3a6a1c8c01566725b1699 100644 (file)
@@ -6122,9 +6122,8 @@ vgr_process_args(
     }
 
     // Parse the list of arguments, wildcards have already been expanded.
-    if (get_arglist_exp(p, &args->fcount, &args->fnames, TRUE) == FAIL)
-       return FAIL;
-    if (args->fcount == 0)
+    if ((get_arglist_exp(p, &args->fcount, &args->fnames, TRUE) == FAIL) ||
+       args->fcount == 0)
     {
        emsg(_(e_nomatch));
        return FAIL;
index 7bf453fa3bddd631cf0a060f79c2fcff47f80120..24526bd77ac3bf6539a44b5f93e1a8e3f22dd607 100644 (file)
@@ -5621,4 +5621,19 @@ func Test_win_gettype()
   lclose
 endfunc
 
+fun Test_vimgrep_nomatch()
+  call XexprTests('c')
+  call g:Xsetlist([{'lnum':10,'text':'Line1'}])
+  copen
+  if has("win32")
+    call assert_fails('vimgrep foo *.zzz', 'E479:')
+    let expected = [{'lnum': 10, 'bufnr': 0, 'end_lnum': 0, 'pattern': '', 'valid': 0, 'vcol': 0, 'nr': 0, 'module': '', 'type': '', 'end_col': 0, 'col': 0, 'text': 'Line1'}]
+  else
+    call assert_fails('vimgrep foo *.zzz', 'E480:')
+    let expected = []
+  endif
+  call assert_equal(expected, getqflist())
+  cclose
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index d6f409ed5c3e99200028c216584aa3c5a3ba3706..30be8aedf8f9335037a77f4e2149e081f490c66f 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3713,
 /**/
     3712,
 /**/