diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-23 18:55:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-23 18:55:11 +0800 |
commit | 0371d0f7afa5e01dd2ac8bbd3abcf0f7454872b3 (patch) | |
tree | a12edba6f135a7b2ca9fa49f9c95f09d1a56f12e /src/nvim/ex_getln.c | |
parent | d58bf4ff307060829ba01f41dca52416105243d3 (diff) | |
download | rneovim-0371d0f7afa5e01dd2ac8bbd3abcf0f7454872b3.tar.gz rneovim-0371d0f7afa5e01dd2ac8bbd3abcf0f7454872b3.tar.bz2 rneovim-0371d0f7afa5e01dd2ac8bbd3abcf0f7454872b3.zip |
refactor(win_close): remove "force", don't pass on "free_buf" (#21921)
Problem:
The "force" flag of win_close() complicates the code and adds edge cases
where it is not clear what the correct behavior should be.
The "free_buf" flag of win_close() is passed on to float windows when
closing the last window of a tabpage, which doesn't make much sense.
Solution:
Remove the "force" flag and always close float windows as if :close! is
used when closing the last window of a tabpage, and set the "free_buf"
flag for a float window based on whether its buffer can be freed.
As 'hidden' is on by default, this change shouldn't affect many people.
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index c62142310d..de671872dd 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4355,7 +4355,7 @@ static int open_cmdwin(void) // Create empty command-line buffer. if (buf_open_scratch(0, _("[Command Line]")) == FAIL) { // Some autocommand messed it up? - win_close(curwin, true, false); + win_close(curwin, true); ga_clear(&winsizes); cmdwin_type = 0; return Ctrl_C; @@ -4520,7 +4520,7 @@ static int open_cmdwin(void) // win_goto() may trigger an autocommand that already closes the // cmdline window. if (win_valid(wp) && wp != curwin) { - win_close(wp, true, false); + win_close(wp, true); } // win_close() may have already wiped the buffer when 'bh' is |