aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-06 05:02:57 +0800
committerGitHub <noreply@github.com>2022-11-06 05:02:57 +0800
commitd5dd7573f32411746867b935b8db2165d14018ec (patch)
tree07fc244e61a725e6a1e4ee2db6e647721a02be77
parent19729e213649c12a5625c021203e8e07027ce5c1 (diff)
downloadrneovim-d5dd7573f32411746867b935b8db2165d14018ec.tar.gz
rneovim-d5dd7573f32411746867b935b8db2165d14018ec.tar.bz2
rneovim-d5dd7573f32411746867b935b8db2165d14018ec.zip
vim-patch:8.2.3713: MS-Windows: no error if vimgrep pattern is not matching (#20947)
Problem: MS-Windows: No error message if vimgrep pattern is not matching. Solution: Give an error message. (Christian Brabandt, closes vim/vim#9245, closes vim/vim#8762) https://github.com/vim/vim/commit/0b226f60be5c30c32fb01fc0b6dc11286e7e2313 Co-authored-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/nvim/quickfix.c6
-rw-r--r--src/nvim/testdir/test_quickfix.vim15
2 files changed, 17 insertions, 4 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index acf9b881f8..5d101ee415 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -5325,10 +5325,8 @@ static int vgr_process_args(exarg_T *eap, vgr_args_T *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;
}
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 99d9c9c1fa..9d9fc5e77b 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -5801,6 +5801,21 @@ 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
+
" Test for opening the quickfix window in two tab pages and then closing one
" of the quickfix windows. This should not make the quickfix buffer unlisted.
" (github issue #9300).