mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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.
de653f0880
This commit is contained in:
parent
f8f04350bd
commit
a584375e9f
@ -5581,6 +5581,8 @@ static void au_del_group(char_u *name)
|
|||||||
i = au_find_group(name);
|
i = au_find_group(name);
|
||||||
if (i == AUGROUP_ERROR) { // the group doesn't exist
|
if (i == AUGROUP_ERROR) { // the group doesn't exist
|
||||||
EMSG2(_("E367: No such group: \"%s\""), name);
|
EMSG2(_("E367: No such group: \"%s\""), name);
|
||||||
|
} else if (i == current_augroup) {
|
||||||
|
EMSG(_("E936: Cannot delete the current group"));
|
||||||
} else {
|
} else {
|
||||||
event_T event;
|
event_T event;
|
||||||
AutoPat *ap;
|
AutoPat *ap;
|
||||||
|
@ -182,13 +182,17 @@ func Test_augroup_warning()
|
|||||||
doautocmd VimEnter
|
doautocmd VimEnter
|
||||||
redir END
|
redir END
|
||||||
call assert_true(match(res, "W19:") < 0)
|
call assert_true(match(res, "W19:") < 0)
|
||||||
|
au! VimEnter
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_augroup_deleted()
|
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
|
||||||
|
augroup end
|
||||||
augroup! x
|
augroup! x
|
||||||
au VimEnter * echo
|
call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
|
||||||
au VimEnter
|
au! VimEnter
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ static int included_patches[] = {
|
|||||||
// 2317,
|
// 2317,
|
||||||
// 2316 NA
|
// 2316 NA
|
||||||
// 2315,
|
// 2315,
|
||||||
// 2314,
|
2314,
|
||||||
2313,
|
2313,
|
||||||
2312,
|
2312,
|
||||||
// 2311 NA
|
// 2311 NA
|
||||||
|
Loading…
Reference in New Issue
Block a user