mirror of
https://github.com/vim/vim.git
synced 2025-07-25 10:54:51 -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:
parent
76ab5446d5
commit
b63f3ca66d
@ -2710,6 +2710,12 @@ do_ecmd(
|
|||||||
*/
|
*/
|
||||||
if (buf != curbuf)
|
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
|
* Be careful: The autocommands may delete any buffer and change
|
||||||
* the current buffer.
|
* the current buffer.
|
||||||
@ -2724,6 +2730,9 @@ do_ecmd(
|
|||||||
new_name = vim_strsave(buf->b_fname);
|
new_name = vim_strsave(buf->b_fname);
|
||||||
set_bufref(&au_new_curbuf, buf);
|
set_bufref(&au_new_curbuf, buf);
|
||||||
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
|
||||||
|
#ifdef FEAT_CMDWIN
|
||||||
|
cmdwin_type = save_cmdwin_type;
|
||||||
|
#endif
|
||||||
if (!bufref_valid(&au_new_curbuf))
|
if (!bufref_valid(&au_new_curbuf))
|
||||||
{
|
{
|
||||||
// new buffer has been deleted
|
// new buffer has been deleted
|
||||||
|
@ -1237,6 +1237,7 @@ func Test_cmdwin_autocmd()
|
|||||||
|
|
||||||
augroup CmdWin
|
augroup CmdWin
|
||||||
au!
|
au!
|
||||||
|
autocmd BufLeave * if &buftype == '' | update | endif
|
||||||
autocmd CmdwinEnter * startinsert
|
autocmd CmdwinEnter * startinsert
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2433,
|
||||||
/**/
|
/**/
|
||||||
2432,
|
2432,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user