fix(window): :close may cause Nvim to quit with autocmd and float

Problem:  :close may cause Nvim to quit if an autocommand triggered when
          closing the buffer closes all other non-floating windows and
          there are floating windows.
Solution: Correct the check for the only non-floating window.
This commit is contained in:
zeertzjq
2024-03-09 12:47:40 +08:00
parent 6416c6bc94
commit 33dfb5a383
3 changed files with 46 additions and 37 deletions

View File

@@ -568,7 +568,7 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last, bool i
}
buf->b_locked--;
buf->b_locked_split--;
if (abort_if_last && last_nonfloat(win)) {
if (abort_if_last && one_window(win)) {
// Autocommands made this the only window.
emsg(_(e_auabort));
return false;
@@ -587,7 +587,7 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last, bool i
}
buf->b_locked--;
buf->b_locked_split--;
if (abort_if_last && last_nonfloat(win)) {
if (abort_if_last && one_window(win)) {
// Autocommands made this the only window.
emsg(_(e_auabort));
return false;