neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 42afb9153a8380fdbace81c86f789e7b8af2c65c
parent 824a31cd0d55752b01a9bdd1f38f756e079e25e8
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Wed,  5 Oct 2022 21:30:25 +0800

vim-patch:8.2.3886: can define autocmd for every event by using "au!"

Problem:    Can define autocmd for every event by using "au!".
Solution:   Check if a command is present also for "au!".
https://github.com/vim/vim/commit/b6db1467622be046dbf00b2213fd9f49f4f3cccb

Diffstat:
Msrc/nvim/autocmd.c | 2+-
Msrc/nvim/testdir/test_arglist.vim | 2+-
Msrc/nvim/testdir/test_autocmd.vim | 1+
3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c @@ -881,7 +881,7 @@ void do_autocmd(char *arg_in, int forceit) } } else { if (*arg == '*' || *arg == NUL || *arg == '|') { - if (!forceit && *cmd != NUL) { + if (*cmd != NUL) { emsg(_(e_cannot_define_autocommands_for_all_events)); } else { do_all_autocmd_events(pat, once, nested, cmd, forceit, group); diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim @@ -605,7 +605,7 @@ endfunc func Test_clear_arglist_in_all() n 0 00 000 0000 00000 000000 - au! * 0 n 0 + au WinNew 0 n 0 call assert_fails("all", "E1156") au! * endfunc diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim @@ -2054,6 +2054,7 @@ endfunc func Test_autocommand_all_events() call assert_fails('au * * bwipe', 'E1155:') call assert_fails('au * x bwipe', 'E1155:') + call assert_fails('au! * x bwipe', 'E1155:') endfunc func Test_autocmd_user()