diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-11 22:18:48 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-13 20:47:26 -0400 |
commit | 07f6f12cf529da403ccb1f3df48d266fa2008db7 (patch) | |
tree | b16d9f2fe7cd73c6569fee7bb811266c21f31ec5 /src/nvim/ex_cmds.c | |
parent | 3f9fa730ceb059ab94dcd20b8f323faca1417110 (diff) | |
download | rneovim-07f6f12cf529da403ccb1f3df48d266fa2008db7.tar.gz rneovim-07f6f12cf529da403ccb1f3df48d266fa2008db7.tar.bz2 rneovim-07f6f12cf529da403ccb1f3df48d266fa2008db7.zip |
vim-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.
https://github.com/vim/vim/commit/b63f3ca66db20f7b135aae706d36be538f91f8cc
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 18530a7d58..fde0abdd4b 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2434,6 +2434,11 @@ int do_ecmd( * is returned by buflist_new(), nothing to do here. */ if (buf != curbuf) { + const int save_cmdwin_type = cmdwin_type; + + // BufLeave applies to the old buffer. + cmdwin_type = 0; + /* * Be careful: The autocommands may delete any buffer and change * the current buffer. @@ -2449,6 +2454,7 @@ int do_ecmd( } set_bufref(&au_new_curbuf, buf); apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf); + cmdwin_type = save_cmdwin_type; if (!bufref_valid(&au_new_curbuf)) { // New buffer has been deleted. delbuf_msg(new_name); // Frees new_name. |