To: vim_dev@googlegroups.com Subject: Patch 8.2.1059 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1059 Problem: Crash when using :tabonly in an autocommand. (Yegappan Lakshmanan) Solution: Do not allow the autocommand window to be closed. Files: src/ex_docmd.c, src/window.c, src/globals.h, src/testdir/test_autocmd.vim *** ../vim-8.2.1058/src/ex_docmd.c 2020-06-24 20:33:59.565106319 +0200 --- src/ex_docmd.c 2020-06-26 19:41:37.004798602 +0200 *************** *** 5178,5183 **** --- 5178,5190 ---- int need_hide; buf_T *buf = win->w_buffer; + // Never close the autocommand window. + if (win == aucmd_win) + { + emsg(_(e_autocmd_close)); + return; + } + need_hide = (bufIsChanged(buf) && buf->b_nwindows <= 1); if (need_hide && !buf_hide(buf) && !forceit) { *** ../vim-8.2.1058/src/window.c 2020-06-07 17:03:15.189741376 +0200 --- src/window.c 2020-06-26 19:41:04.356909667 +0200 *************** *** 2461,2467 **** return FAIL; // window is already being closed if (win_unlisted(win)) { ! emsg(_("E813: Cannot close autocmd or popup window")); return FAIL; } if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window()) --- 2461,2467 ---- return FAIL; // window is already being closed if (win_unlisted(win)) { ! emsg(_(e_autocmd_close)); return FAIL; } if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window()) *** ../vim-8.2.1058/src/globals.h 2020-06-24 20:33:59.565106319 +0200 --- src/globals.h 2020-06-26 19:41:26.120835604 +0200 *************** *** 1765,1770 **** --- 1765,1771 ---- #endif EXTERN char e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\"")); EXTERN char e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior")); + EXTERN char e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd or popup window")); #ifdef FEAT_MENU EXTERN char e_menuothermode[] INIT(= N_("E328: Menu only exists in another mode")); #endif *** ../vim-8.2.1058/src/testdir/test_autocmd.vim 2020-06-25 19:01:32.989844093 +0200 --- src/testdir/test_autocmd.vim 2020-06-26 19:43:23.892437279 +0200 *************** *** 2617,2623 **** au! augroup END augroup! aucmd_win_test2 ! %bw! endfunc " vim: shiftwidth=2 sts=2 expandtab --- 2617,2643 ---- au! augroup END augroup! aucmd_win_test2 ! %bwipe! ! endfunc ! ! " Test for trying to close the tab that has the temporary window for exeucing ! " an autocmd. ! func Test_close_autocmd_tab() ! edit one.txt ! tabnew two.txt ! augroup aucmd_win_test ! au! ! au BufEnter * if expand('') == 'one.txt' | tabfirst | tabonly | endif ! augroup END ! ! call assert_fails('doautoall BufEnter', 'E813:') ! ! tabonly ! augroup aucmd_win_test ! au! ! augroup END ! augroup! aucmd_win_test ! %bwipe! endfunc " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.1058/src/version.c 2020-06-25 22:23:45.089461529 +0200 --- src/version.c 2020-06-26 19:40:51.768952578 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1059, /**/ -- Dogs must have a permit signed by the mayor in order to congregate in groups of three or more on private property. [real standing law in Oklahoma, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///