diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-09-03 16:59:06 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-09-03 16:59:06 +0200 |
commit | de653f08805dde14424d417502a0480a6ad292f8 (patch) | |
tree | 455032d1febac1d084c69e3ca2cc7bb08b8def3b /src | |
parent | b62cc36a600e2e1e5a1d1d484fef89898c847c4c (diff) |
patch 7.4.2314v7.4.2314
Problem: No error when deleting an augroup while it's the current one.
Solution: Disallow deleting an augroup when it's the current one.
Diffstat (limited to 'src')
-rw-r--r-- | src/fileio.c | 2 | ||||
-rw-r--r-- | src/testdir/test_autocmd.vim | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c index 6d5ed19d17..ea1f338f58 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -8017,6 +8017,8 @@ au_del_group(char_u *name) i = au_find_group(name); if (i == AUGROUP_ERROR) /* the group doesn't exist */ EMSG2(_("E367: No such group: \"%s\""), name); + else if (i == current_augroup) + EMSG(_("E936: Cannot delete the current group")); else { event_T event; diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 7d786c88cf..f05a55f1aa 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -182,13 +182,17 @@ func Test_augroup_warning() doautocmd VimEnter redir END call assert_true(match(res, "W19:") < 0) + au! VimEnter endfunc func Test_augroup_deleted() - " This caused a crash + " This caused a crash before E936 was introduced augroup x + call assert_fails('augroup! x', 'E936:') + au VimEnter * echo + augroup end augroup! x - au VimEnter * echo - au VimEnter + call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0) + au! VimEnter endfunc diff --git a/src/version.c b/src/version.c index 8c10a9413e..eb1c302144 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2314, +/**/ 2313, /**/ 2312, |