summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-30 21:40:03 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-30 21:40:03 +0100
commitb63f3ca66db20f7b135aae706d36be538f91f8cc (patch)
treed34ee3698061bb62e3d7a04d58950d3998c64dd9
parent76ab5446d530a1c81ead0ee42cb55b4a4d515bad (diff)
downloadvim-git-b63f3ca66db20f7b135aae706d36be538f91f8cc.tar.gz
patch 8.2.2433: opening cmdline window gives error in BufLeave autocommandv8.2.2433
Problem: Opening cmdline window gives error in BufLeave autocommand. Solution: Reset cmdwin_type when triggering the autocommand.
-rw-r--r--src/ex_cmds.c9
-rw-r--r--src/testdir/test_cmdline.vim1
-rw-r--r--src/version.c2
3 files changed, 12 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 12219e7ba..b678f6699 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -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
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index c2bbcc6c0..7f62dfe77 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -1237,6 +1237,7 @@ func Test_cmdwin_autocmd()
augroup CmdWin
au!
+ autocmd BufLeave * if &buftype == '' | update | endif
autocmd CmdwinEnter * startinsert
augroup END
diff --git a/src/version.c b/src/version.c
index dc20c3349..555a2f937 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2433,
+/**/
2432,
/**/
2431,