aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2023-07-23 23:10:28 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2023-07-26 20:44:46 +0100
commit5d921e28c1cc33eced22bbfa823460ca241e3dc1 (patch)
treead06c2e4edc74e687f213f133557a8e085100aac /src/nvim/ex_getln.c
parent6b4970f6e0ac36021b2a8bd0533f5078040d31f7 (diff)
downloadrneovim-5d921e28c1cc33eced22bbfa823460ca241e3dc1.tar.gz
rneovim-5d921e28c1cc33eced22bbfa823460ca241e3dc1.tar.bz2
rneovim-5d921e28c1cc33eced22bbfa823460ca241e3dc1.zip
feat(api): allow win_close in cmdwin to close wins except previous
Disallow closing the previous window from `nvim_win_close`, as this will cause issues. Again, no telling how safe this is. It also requires exposing old_curwin. :/ Also note that it's possible for the `&cmdheight` to change if, for example, there are 2 tabpages and `nvim_win_close` is used to close the last window in the other tabpage while `&stal` is 1. This is addressed in a later commit.
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 9dcfa99a37..5f1f5d5adc 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -4398,6 +4398,7 @@ static int open_cmdwin(void)
// Set "cmdwin_type" before any autocommands may mess things up.
cmdwin_type = get_cmdline_type();
cmdwin_level = ccline.level;
+ cmdwin_old_curwin = old_curwin;
// Create empty command-line buffer.
if (buf_open_scratch(0, _("[Command Line]")) == FAIL) {
@@ -4405,6 +4406,7 @@ static int open_cmdwin(void)
win_close(curwin, true, false);
ga_clear(&winsizes);
cmdwin_type = 0;
+ cmdwin_old_curwin = NULL;
return Ctrl_C;
}
// Command-line buffer has bufhidden=wipe, unlike a true "scratch" buffer.
@@ -4501,6 +4503,7 @@ static int open_cmdwin(void)
cmdwin_type = 0;
cmdwin_level = 0;
+ cmdwin_old_curwin = NULL;
exmode_active = save_exmode;