Patch 8.0.1190
Problem:    Vim becomes unusable after opening new window in BufWritePre
            event.
Solution:   Call not_exiting(). (Martin Tournoij, closes #2205)
            Also for "2q" when a help window is open.  Add a test.
Files:      src/ex_docmd.c, src/testdir/test_writefile.vim


*** ../vim-8.0.1189/src/ex_docmd.c      2017-10-14 15:24:43.100046788 +0200
--- src/ex_docmd.c      2017-10-14 16:05:17.415087662 +0200
***************
*** 7261,7266 ****
--- 7261,7267 ----
         */
        if (only_one_window() && (ONE_WINDOW || eap->addr_count == 0))
            getout(0);
+       not_exiting();
  #ifdef FEAT_GUI
        need_mouse_correct = TRUE;
  #endif
***************
*** 7799,7804 ****
--- 7800,7806 ----
      {
        if (only_one_window())      /* quit last window, exit Vim */
            getout(0);
+       not_exiting();
  # ifdef FEAT_GUI
        need_mouse_correct = TRUE;
  # endif
*** ../vim-8.0.1189/src/testdir/test_writefile.vim      2017-06-27 
22:11:36.131082741 +0200
--- src/testdir/test_writefile.vim      2017-10-14 16:05:03.675183675 +0200
***************
*** 49,51 ****
--- 49,95 ----
    bwipe!
    set backup& writebackup&
  endfunc
+ 
+ func SetFlag(timer)
+   let g:flag = 1
+ endfunc
+ 
+ func Test_write_quit_split()
+   " Prevent exiting by splitting window on file write.
+   augroup testgroup
+     autocmd BufWritePre * split
+   augroup END
+   e! Xfile
+   call setline(1, 'nothing')
+   wq
+ 
+   if has('timers')
+     " timer will not run if "exiting" is still set
+     let g:flag = 0
+     call timer_start(1, 'SetFlag')
+     sleep 50m
+     call assert_equal(1, g:flag)
+     unlet g:flag
+   endif
+   au! testgroup
+   bwipe Xfile
+   call delete('Xfile')
+ endfunc
+ 
+ func Test_nowrite_quit_split()
+   " Prevent exiting by opening a help window.
+   e! Xfile
+   help
+   wincmd w
+   exe winnr() . 'q'
+ 
+   if has('timers')
+     " timer will not run if "exiting" is still set
+     let g:flag = 0
+     call timer_start(1, 'SetFlag')
+     sleep 50m
+     call assert_equal(1, g:flag)
+     unlet g:flag
+   endif
+   bwipe Xfile
+ endfunc
*** ../vim-8.0.1189/src/version.c       2017-10-14 15:24:43.104046760 +0200
--- src/version.c       2017-10-14 15:56:08.270927426 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1190,
  /**/

-- 
You were lucky. We lived for three months in a brown paper bag in a 
septic tank. We used to have to get up at six o'clock in the morning, 
clean the bag, eat a crust of stale bread, go to work down mill for 
fourteen hours a day week in-week out. When we got home, our Dad
would thrash us to sleep with his belt!

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui