mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 16:28:17 +00:00
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.
This commit is contained in:
@@ -3006,7 +3006,7 @@ static void qf_jump_newwin(qf_info_T *qi, int dir, int errornr, int forceit, boo
|
||||
|
||||
if (retval != OK) {
|
||||
if (opened_window) {
|
||||
win_close(curwin, true, false); // Close opened window
|
||||
win_close(curwin, true); // Close opened window
|
||||
}
|
||||
if (qf_ptr != NULL && qf_ptr->qf_fnum != 0) {
|
||||
// Couldn't open file, so put index back where it was. This could
|
||||
@@ -3548,7 +3548,7 @@ void ex_cclose(exarg_T *eap)
|
||||
// Find existing quickfix window and close it.
|
||||
win_T *win = qf_find_win(qi);
|
||||
if (win != NULL) {
|
||||
win_close(win, false, false);
|
||||
win_close(win, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5709,7 +5709,7 @@ static void wipe_dummy_buffer(buf_T *buf, char *dirname_start)
|
||||
if (firstwin->w_next != NULL) {
|
||||
for (win_T *wp = firstwin; wp != NULL; wp = wp->w_next) {
|
||||
if (wp->w_buffer == buf) {
|
||||
if (win_close(wp, false, false) == OK) {
|
||||
if (win_close(wp, false) == OK) {
|
||||
did_one = true;
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user