diff options
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 11 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c index 66726d279..6581ba939 100644 --- a/src/main.c +++ b/src/main.c @@ -1376,6 +1376,9 @@ getout(exitval) for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next) { + if (wp->w_buffer == NULL) + /* Autocmd must have close the buffer already, skip. */ + continue; buf = wp->w_buffer; if (buf->b_changedtick != -1) { diff --git a/src/version.c b/src/version.c index c9bf6ded7..375b07d49 100644 --- a/src/version.c +++ b/src/version.c @@ -726,6 +726,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 765, +/**/ 764, /**/ 763, diff --git a/src/window.c b/src/window.c index e37450d98..b5d4afd2b 100644 --- a/src/window.c +++ b/src/window.c @@ -2276,9 +2276,15 @@ win_close(win, free_buf) #endif } + if (only_one_window() && win_valid(win) && win->w_buffer == NULL + && (last_window() || curtab != prev_curtab + || close_last_window_tabpage(win, free_buf, prev_curtab))) + /* Autocommands have close all windows, quit now. */ + getout(0); + /* Autocommands may have closed the window already, or closed the only * other window or moved to another tab page. */ - if (!win_valid(win) || last_window() || curtab != prev_curtab + else if (!win_valid(win) || last_window() || curtab != prev_curtab || close_last_window_tabpage(win, free_buf, prev_curtab)) return; @@ -6282,7 +6288,8 @@ only_one_window() return FALSE; for (wp = firstwin; wp != NULL; wp = wp->w_next) - if ((!((wp->w_buffer->b_help && !curbuf->b_help) + if (wp->w_buffer != NULL + && (!((wp->w_buffer->b_help && !curbuf->b_help) # ifdef FEAT_QUICKFIX || wp->w_p_pvw # endif |