diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2023-07-27 01:38:23 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2024-01-28 12:29:26 +0000 |
commit | cf140fb25b94c556396fe942a4af3e8db9effa37 (patch) | |
tree | ad454e6616d049d60b18d11929c16bfb0af52003 /src/nvim/window.c | |
parent | 2cd76a758b4511748d9482e5af58162a608516b4 (diff) | |
download | rneovim-cf140fb25b94c556396fe942a4af3e8db9effa37.tar.gz rneovim-cf140fb25b94c556396fe942a4af3e8db9effa37.tar.bz2 rneovim-cf140fb25b94c556396fe942a4af3e8db9effa37.zip |
vim-patch:9.1.0047: issues with temp curwin/buf while cmdwin is open
Problem: Things that temporarily change/restore curwin/buf (e.g:
win_execute, some autocmds) may break assumptions that
curwin/buf is the cmdwin when "cmdwin_type != 0", causing
issues.
Solution: Expose the cmdwin's real win/buf and check that instead. Also
try to ensure these variables are NULL if "cmdwin_type == 0",
allowing them to be used directly in most cases without
checking cmdwin_type. (Sean Dewar)
Reset and save `cmdwin_old_curwin` in a similar fashion.
Apply suitable changes for API functions and add Lua tests.
https://github.com/vim/vim/commit/988f74311c26ea9917e84fbae608de226dba7e5f
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 23779d1e7b..112ac8bf3b 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2485,7 +2485,7 @@ bool can_close_in_cmdwin(win_T *win, Error *err) FUNC_ATTR_NONNULL_ALL { if (cmdwin_type != 0) { - if (win == curwin) { + if (win == cmdwin_win) { cmdwin_result = Ctrl_C; return false; } else if (win == cmdwin_old_curwin) { @@ -3030,6 +3030,9 @@ void win_free_all(void) { // avoid an error for switching tabpage with the cmdline window open cmdwin_type = 0; + cmdwin_buf = NULL; + cmdwin_win = NULL; + cmdwin_old_curwin = NULL; while (first_tabpage->tp_next != NULL) { tabpage_close(true); |