0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

patch 8.2.2433: opening cmdline window gives error in BufLeave autocommand

Problem:    Opening cmdline window gives error in BufLeave autocommand.
Solution:   Reset cmdwin_type when triggering the autocommand.
This commit is contained in:
Bram Moolenaar 2021-01-30 21:40:03 +01:00
parent 76ab5446d5
commit b63f3ca66d
3 changed files with 12 additions and 0 deletions

View File

@ -2710,6 +2710,12 @@ do_ecmd(
*/
if (buf != curbuf)
{
#ifdef FEAT_CMDWIN
int save_cmdwin_type = cmdwin_type;
// BufLeave applies to the old buffer.
cmdwin_type = 0;
#endif
/*
* Be careful: The autocommands may delete any buffer and change
* the current buffer.
@ -2724,6 +2730,9 @@ do_ecmd(
new_name = vim_strsave(buf->b_fname);
set_bufref(&au_new_curbuf, buf);
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
#ifdef FEAT_CMDWIN
cmdwin_type = save_cmdwin_type;
#endif
if (!bufref_valid(&au_new_curbuf))
{
// new buffer has been deleted

View File

@ -1237,6 +1237,7 @@ func Test_cmdwin_autocmd()
augroup CmdWin
au!
autocmd BufLeave * if &buftype == '' | update | endif
autocmd CmdwinEnter * startinsert
augroup END

View File

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