Patch 7.4.1837
Problem:    The BufUnload event is triggered twice, when :bunload is used with
            `bufhidden` set to `unload` or `delete`.
Solution:   Do not trigger the event when ml_mfp is NULL. (Hirohito Higashi)
Files:      src/buffer.c, src/testdir/test_autocmd.vim


*** ../vim-7.4.1836/src/buffer.c        2016-05-09 20:38:48.576112188 +0200
--- src/buffer.c        2016-05-24 16:05:07.911279010 +0200
***************
*** 574,582 ****
      int               is_curbuf = (buf == curbuf);
  
      buf->b_closing = TRUE;
!     apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf);
!     if (!buf_valid(buf))          /* autocommands may delete the buffer */
!       return;
      if ((flags & BFA_DEL) && buf->b_p_bl)
      {
        apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf);
--- 574,585 ----
      int               is_curbuf = (buf == curbuf);
  
      buf->b_closing = TRUE;
!     if (buf->b_ml.ml_mfp != NULL)
!     {
!       apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf);
!       if (!buf_valid(buf))        /* autocommands may delete the buffer */
!           return;
!     }
      if ((flags & BFA_DEL) && buf->b_p_bl)
      {
        apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf);
*** ../vim-7.4.1836/src/testdir/test_autocmd.vim        2016-04-20 
20:18:16.957270339 +0200
--- src/testdir/test_autocmd.vim        2016-05-24 16:04:28.091279558 +0200
***************
*** 7,35 ****
    " becomes one.
  endfunc
  
! if !has('timers')
!   finish
  endif
  
! func ExitInsertMode(id)
!   call feedkeys("\<Esc>")
! endfunc
  
! func Test_cursorhold_insert()
!   let g:triggered = 0
!   au CursorHoldI * let g:triggered += 1
!   set updatetime=20
!   call timer_start(100, 'ExitInsertMode')
!   call feedkeys('a', 'x!')
!   call assert_equal(1, g:triggered)
! endfunc
  
! func Test_cursorhold_insert_ctrl_x()
!   let g:triggered = 0
!   au CursorHoldI * let g:triggered += 1
!   set updatetime=20
!   call timer_start(100, 'ExitInsertMode')
!   " CursorHoldI does not trigger after CTRL-X
!   call feedkeys("a\<C-X>", 'x!')
!   call assert_equal(0, g:triggered)
  endfunc
--- 7,62 ----
    " becomes one.
  endfunc
  
! if has('timers')
!   func ExitInsertMode(id)
!     call feedkeys("\<Esc>")
!   endfunc
! 
!   func Test_cursorhold_insert()
!     let g:triggered = 0
!     au CursorHoldI * let g:triggered += 1
!     set updatetime=20
!     call timer_start(100, 'ExitInsertMode')
!     call feedkeys('a', 'x!')
!     call assert_equal(1, g:triggered)
!   endfunc
! 
!   func Test_cursorhold_insert_ctrl_x()
!     let g:triggered = 0
!     au CursorHoldI * let g:triggered += 1
!     set updatetime=20
!     call timer_start(100, 'ExitInsertMode')
!     " CursorHoldI does not trigger after CTRL-X
!     call feedkeys("a\<C-X>", 'x!')
!     call assert_equal(0, g:triggered)
!   endfunc
  endif
  
! function Test_bufunload()
!   augroup test_bufunload_group
!     autocmd!
!     autocmd BufUnload * call add(s:li, "bufunload")
!     autocmd BufDelete * call add(s:li, "bufdelete")
!     autocmd BufWipeout * call add(s:li, "bufwipeout")
!   augroup END
  
!   let s:li=[]
!   new
!   setlocal bufhidden=
!   bunload
!   call assert_equal(["bufunload", "bufdelete"], s:li)
! 
!   let s:li=[]
!   new
!   setlocal bufhidden=delete
!   bunload
!   call assert_equal(["bufunload", "bufdelete"], s:li)
! 
!   let s:li=[]
!   new
!   setlocal bufhidden=unload
!   bwipeout
!   call assert_equal(["bufunload", "bufdelete", "bufwipeout"], s:li)
  
!   augroup! test_bufunload_group
  endfunc
*** ../vim-7.4.1836/src/version.c       2016-05-24 15:43:46.703296634 +0200
--- src/version.c       2016-05-24 16:04:04.311279885 +0200
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     1837,
  /**/

-- 
If someone questions your market projections, simply point out that your
target market is "People who are nuts" and "People who will buy any damn
thing".  Nobody is going to tell you there aren't enough of those people
to go around.
                                (Scott Adams - The Dilbert principle)

 /// 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