0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 7.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.
This commit is contained in:
Bram Moolenaar
2016-09-03 16:59:06 +02:00
parent b62cc36a60
commit de653f0880
3 changed files with 11 additions and 3 deletions

View File

@@ -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;

View File

@@ -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
augroup! x
call assert_fails('augroup! x', 'E936:')
au VimEnter * echo
au VimEnter
augroup end
augroup! x
call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
au! VimEnter
endfunc

View File

@@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2314,
/**/
2313,
/**/