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/main.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/main.c')
-rw-r--r-- | src/nvim/main.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index bbe877356d..fa930b2b1e 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1723,7 +1723,7 @@ static void edit_buffers(mparm_T *parmp, char *cwd) // When w_arg_idx is -1 remove the window (see create_windows()). if (curwin->w_arg_idx == -1) { - win_close(curwin, true, false); + win_close(curwin, true); advance = false; } @@ -1735,7 +1735,7 @@ static void edit_buffers(mparm_T *parmp, char *cwd) // When w_arg_idx is -1 remove the window (see create_windows()). if (curwin->w_arg_idx == -1) { arg_idx++; - win_close(curwin, true, false); + win_close(curwin, true); advance = false; continue; } @@ -1782,7 +1782,7 @@ static void edit_buffers(mparm_T *parmp, char *cwd) did_emsg = false; // avoid hit-enter prompt getout(1); } - win_close(curwin, true, false); + win_close(curwin, true); advance = false; } if (arg_idx == GARGCOUNT - 1) { |