Patch 8.2.4609
Problem: :unhide does not check for failing to close a window.
Solution: When closing a window fails continue with the next one. Do not
try closing the autocmd window. (closes #9984)
Files: src/buffer.c, src/window.c, src/proto/window.pro,
src/testdir/test_autocmd.vim
*** ../vim-8.2.4608/src/buffer.c 2022-02-28 13:28:34.540563790 +0000
--- src/buffer.c 2022-03-22 18:02:23.017146943 +0000
***************
*** 5330,5346 ****
{
wpnext = wp->w_next;
if ((wp->w_buffer->b_nwindows > 1
! || ((cmdmod.cmod_split & WSP_VERT)
! ? wp->w_height + wp->w_status_height < Rows - p_ch
! - tabline_height()
! : wp->w_width != Columns)
! || (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW
! && !(wp->w_closing || wp->w_buffer->b_locked > 0))
{
! win_close(wp, FALSE);
! wpnext = firstwin; // just in case an autocommand does
! // something strange with windows
! tpnext = first_tabpage; // start all over...
open_wins = 0;
}
else
--- 5330,5350 ----
{
wpnext = wp->w_next;
if ((wp->w_buffer->b_nwindows > 1
! || ((cmdmod.cmod_split & WSP_VERT)
! ? wp->w_height + wp->w_status_height < Rows - p_ch
! - tabline_height()
! : wp->w_width != Columns)
! || (had_tab > 0 && wp != firstwin))
! && !ONE_WINDOW
! && !(wp->w_closing || wp->w_buffer->b_locked > 0)
! && !win_unlisted(wp))
{
! if (win_close(wp, FALSE) == FAIL)
! break;
! // Just in case an autocommand does something strange with
! // windows: start all over...
! wpnext = firstwin;
! tpnext = first_tabpage;
open_wins = 0;
}
else
*** ../vim-8.2.4608/src/window.c 2022-03-05 17:00:28.753376120 +0000
--- src/window.c 2022-03-22 18:02:37.893177402 +0000
***************
*** 43,49 ****
static int may_open_tabpage(void);
static int win_enter_ext(win_T *wp, int flags);
static void win_free(win_T *wp, tabpage_T *tp);
- static int win_unlisted(win_T *wp);
static void win_append(win_T *after, win_T *wp);
static void frame_append(frame_T *after, frame_T *frp);
static void frame_insert(frame_T *before, frame_T *frp);
--- 43,48 ----
***************
*** 5233,5239 ****
* Return TRUE if "wp" is not in the list of windows: the autocmd window or a
* popup window.
*/
! static int
win_unlisted(win_T *wp)
{
return wp == aucmd_win || WIN_IS_POPUP(wp);
--- 5232,5238 ----
* Return TRUE if "wp" is not in the list of windows: the autocmd window or a
* popup window.
*/
! int
win_unlisted(win_T *wp)
{
return wp == aucmd_win || WIN_IS_POPUP(wp);
*** ../vim-8.2.4608/src/proto/window.pro 2022-02-20 20:48:53.226071796
+0000
--- src/proto/window.pro 2022-03-22 18:02:16.885133869 +0000
***************
*** 46,51 ****
--- 46,52 ----
void win_enter(win_T *wp, int undo_sync);
win_T *buf_jump_open_win(buf_T *buf);
win_T *buf_jump_open_tab(buf_T *buf);
+ int win_unlisted(win_T *wp);
void win_free_popup(win_T *win);
void win_remove(win_T *wp, tabpage_T *tp);
int win_alloc_lines(win_T *wp);
*** ../vim-8.2.4608/src/testdir/test_autocmd.vim 2022-03-04
20:10:33.400917886 +0000
--- src/testdir/test_autocmd.vim 2022-03-22 18:08:54.729486028 +0000
***************
*** 3,8 ****
--- 3,9 ----
source shared.vim
source check.vim
source term_util.vim
+ import './vim9.vim' as v9
func s:cleanup_buffers() abort
for bnr in range(1, bufnr('$'))
***************
*** 2975,2978 ****
--- 2976,2993 ----
bw!
endfunc
+ func Test_closing_autocmd_window()
+ let lines =<< trim END
+ edit Xa.txt
+ tabnew Xb.txt
+ autocmd BufEnter Xa.txt unhide 1
+ doautoall BufEnter
+ END
+ call v9.CheckScriptFailure(lines, 'E814:')
+ au! BufEnter
+ only!
+ bwipe Xa.txt
+ bwipe Xb.txt
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4608/src/version.c 2022-03-22 16:06:24.950137116 +0000
--- src/version.c 2022-03-22 18:08:04.353486048 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4609,
/**/
--
FATHER: Who are you?
PRINCE: I'm ... your son ...
FATHER: Not you.
LAUNCELOT: I'm ... er ... Sir Launcelot, sir.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220322181337.17A441C22D9%40moolenaar.net.