mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 09:56:31 +00:00
fix(float): fix some other crashes with :unhide or :all (#25328)
This commit is contained in:
@@ -857,12 +857,17 @@ static void arg_all_close_unused_windows(arg_all_state_T *aall)
|
||||
while (true) {
|
||||
win_T *wpnext = NULL;
|
||||
tabpage_T *tpnext = curtab->tp_next;
|
||||
for (win_T *wp = firstwin; wp != NULL; wp = wpnext) {
|
||||
// Try to close floating windows first
|
||||
for (win_T *wp = lastwin->w_floating ? lastwin : firstwin; wp != NULL; wp = wpnext) {
|
||||
int i;
|
||||
wpnext = wp->w_next;
|
||||
wpnext = wp->w_floating
|
||||
? wp->w_prev->w_floating ? wp->w_prev : firstwin
|
||||
: (wp->w_next == NULL || wp->w_next->w_floating) ? NULL : wp->w_next;
|
||||
buf_T *buf = wp->w_buffer;
|
||||
if (buf->b_ffname == NULL
|
||||
|| (!aall->keep_tabs && (buf->b_nwindows > 1 || wp->w_width != Columns))) {
|
||||
|| (!aall->keep_tabs
|
||||
&& (buf->b_nwindows > 1 || wp->w_width != Columns
|
||||
|| (wp->w_floating && !is_aucmd_win(wp))))) {
|
||||
i = aall->opened_len;
|
||||
} else {
|
||||
// check if the buffer in this window is in the arglist
|
||||
@@ -917,7 +922,7 @@ static void arg_all_close_unused_windows(arg_all_state_T *aall)
|
||||
(void)autowrite(buf, false);
|
||||
// Check if autocommands removed the window.
|
||||
if (!win_valid(wp) || !bufref_valid(&bufref)) {
|
||||
wpnext = firstwin; // Start all over...
|
||||
wpnext = lastwin->w_floating ? lastwin : firstwin; // Start all over...
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -930,7 +935,7 @@ static void arg_all_close_unused_windows(arg_all_state_T *aall)
|
||||
// check if autocommands removed the next window
|
||||
if (!win_valid(wpnext)) {
|
||||
// start all over...
|
||||
wpnext = firstwin;
|
||||
wpnext = lastwin->w_floating ? lastwin : firstwin;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -977,6 +982,8 @@ static void arg_all_open_windows(arg_all_state_T *aall, int count)
|
||||
if (aall->keep_tabs) {
|
||||
aall->new_curwin = wp;
|
||||
aall->new_curtab = curtab;
|
||||
} else if (wp->w_floating) {
|
||||
break;
|
||||
} else if (wp->w_frame->fr_parent != curwin->w_frame->fr_parent) {
|
||||
emsg(_(e_window_layout_changed_unexpectedly));
|
||||
i = count;
|
||||
@@ -1098,7 +1105,8 @@ static void do_arg_all(int count, int forceit, int keep_tabs)
|
||||
autocmd_no_leave++;
|
||||
last_curwin = curwin;
|
||||
last_curtab = curtab;
|
||||
win_enter(lastwin, false);
|
||||
// lastwin may be aucmd_win
|
||||
win_enter(lastwin_nofloating(), false);
|
||||
|
||||
// Open up to "count" windows.
|
||||
arg_all_open_windows(&aall, count);
|
||||
|
@@ -3622,6 +3622,7 @@ void ex_buffer_all(exarg_T *eap)
|
||||
? wp->w_prev->w_floating ? wp->w_prev : firstwin
|
||||
: (wp->w_next == NULL || wp->w_next->w_floating) ? NULL : wp->w_next;
|
||||
if ((wp->w_buffer->b_nwindows > 1
|
||||
|| wp->w_floating
|
||||
|| ((cmdmod.cmod_split & WSP_VERT)
|
||||
? wp->w_height + wp->w_hsep_height + wp->w_status_height < Rows - p_ch
|
||||
- tabline_height() - global_stl_height()
|
||||
@@ -3656,6 +3657,7 @@ void ex_buffer_all(exarg_T *eap)
|
||||
//
|
||||
// Don't execute Win/Buf Enter/Leave autocommands here.
|
||||
autocmd_no_enter++;
|
||||
// lastwin may be aucmd_win
|
||||
win_enter(lastwin_nofloating(), false);
|
||||
autocmd_no_leave++;
|
||||
for (buf = firstbuf; buf != NULL && open_wins < count; buf = buf->b_next) {
|
||||
@@ -3674,7 +3676,7 @@ void ex_buffer_all(exarg_T *eap)
|
||||
} else {
|
||||
// Check if this buffer already has a window
|
||||
for (wp = firstwin; wp != NULL; wp = wp->w_next) {
|
||||
if (wp->w_buffer == buf) {
|
||||
if (!wp->w_floating && wp->w_buffer == buf) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user