Karsten Hopp e623a3
To: vim_dev@googlegroups.com
Karsten Hopp e623a3
Subject: Patch 7.3.926
Karsten Hopp e623a3
Fcc: outbox
Karsten Hopp e623a3
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp e623a3
Mime-Version: 1.0
Karsten Hopp e623a3
Content-Type: text/plain; charset=UTF-8
Karsten Hopp e623a3
Content-Transfer-Encoding: 8bit
Karsten Hopp e623a3
------------
Karsten Hopp e623a3
Karsten Hopp e623a3
Patch 7.3.926
Karsten Hopp e623a3
Problem:    Autocommands are triggered by setwinvar() et al. Missing BufEnter
Karsten Hopp e623a3
	    on :tabclose. Duplicate WinEnter on :tabclose. Wrong order of
Karsten Hopp e623a3
	    events for :tablose and :tabnew.
Karsten Hopp e623a3
Solution:   Fix these autocommand events. (Zyx)
Karsten Hopp e623a3
Files:	    runtime/doc/eval.txt, src/buffer.c, src/eval.c, src/ex_cmds2.c,
Karsten Hopp e623a3
	    src/fileio.c, src/proto/window.pro, src/testdir/test62.in,
Karsten Hopp e623a3
	    src/testdir/test62.ok, src/window.c
Karsten Hopp e623a3
Karsten Hopp e623a3
Karsten Hopp e623a3
*** ../vim-7.3.925/runtime/doc/eval.txt	2013-02-20 21:11:14.000000000 +0100
Karsten Hopp e623a3
--- runtime/doc/eval.txt	2013-05-06 04:33:13.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 5294,5301 ****
Karsten Hopp e623a3
  		|t:var|
Karsten Hopp e623a3
  		Note that the variable name without "t:" must be used.
Karsten Hopp e623a3
  		Tabs are numbered starting with one.
Karsten Hopp e623a3
- 		Vim briefly goes to the tab page {tabnr}, this may trigger
Karsten Hopp e623a3
- 		TabLeave and TabEnter autocommands.
Karsten Hopp e623a3
  		This function is not available in the |sandbox|.
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  settabwinvar({tabnr}, {winnr}, {varname}, {val})	*settabwinvar()*
Karsten Hopp e623a3
--- 5320,5325 ----
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 5308,5315 ****
Karsten Hopp e623a3
  		doesn't work for a global or local buffer variable.
Karsten Hopp e623a3
  		For a local buffer option the global value is unchanged.
Karsten Hopp e623a3
  		Note that the variable name without "w:" must be used.
Karsten Hopp e623a3
- 		Vim briefly goes to the tab page {tabnr}, this may trigger
Karsten Hopp e623a3
- 		TabLeave and TabEnter autocommands.
Karsten Hopp e623a3
  		Examples: >
Karsten Hopp e623a3
  			:call settabwinvar(1, 1, "&list", 0)
Karsten Hopp e623a3
  			:call settabwinvar(3, 2, "myvar", "foobar")
Karsten Hopp e623a3
--- 5332,5337 ----
Karsten Hopp e623a3
*** ../vim-7.3.925/src/buffer.c	2013-05-06 04:21:35.000000000 +0200
Karsten Hopp e623a3
--- src/buffer.c	2013-05-06 04:33:13.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4551,4557 ****
Karsten Hopp e623a3
       * When the ":tab" modifier was used do this for all tab pages.
Karsten Hopp e623a3
       */
Karsten Hopp e623a3
      if (had_tab > 0)
Karsten Hopp e623a3
! 	goto_tabpage_tp(first_tabpage, TRUE);
Karsten Hopp e623a3
      for (;;)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	tpnext = curtab->tp_next;
Karsten Hopp e623a3
--- 4551,4557 ----
Karsten Hopp e623a3
       * When the ":tab" modifier was used do this for all tab pages.
Karsten Hopp e623a3
       */
Karsten Hopp e623a3
      if (had_tab > 0)
Karsten Hopp e623a3
! 	goto_tabpage_tp(first_tabpage, TRUE, TRUE);
Karsten Hopp e623a3
      for (;;)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	tpnext = curtab->tp_next;
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4663,4669 ****
Karsten Hopp e623a3
  	if (!valid_tabpage(tpnext))
Karsten Hopp e623a3
  	    tpnext = first_tabpage;	/* start all over...*/
Karsten Hopp e623a3
  # endif
Karsten Hopp e623a3
! 	goto_tabpage_tp(tpnext, TRUE);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
      /*
Karsten Hopp e623a3
--- 4663,4669 ----
Karsten Hopp e623a3
  	if (!valid_tabpage(tpnext))
Karsten Hopp e623a3
  	    tpnext = first_tabpage;	/* start all over...*/
Karsten Hopp e623a3
  # endif
Karsten Hopp e623a3
! 	goto_tabpage_tp(tpnext, TRUE, TRUE);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
      /*
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4767,4779 ****
Karsten Hopp e623a3
      if (last_curtab != new_curtab)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	if (valid_tabpage(last_curtab))
Karsten Hopp e623a3
! 	    goto_tabpage_tp(last_curtab, TRUE);
Karsten Hopp e623a3
  	if (win_valid(last_curwin))
Karsten Hopp e623a3
  	    win_enter(last_curwin, FALSE);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
      /* to window with first arg */
Karsten Hopp e623a3
      if (valid_tabpage(new_curtab))
Karsten Hopp e623a3
! 	goto_tabpage_tp(new_curtab, TRUE);
Karsten Hopp e623a3
      if (win_valid(new_curwin))
Karsten Hopp e623a3
  	win_enter(new_curwin, FALSE);
Karsten Hopp e623a3
  
Karsten Hopp e623a3
--- 4767,4779 ----
Karsten Hopp e623a3
      if (last_curtab != new_curtab)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	if (valid_tabpage(last_curtab))
Karsten Hopp e623a3
! 	    goto_tabpage_tp(last_curtab, TRUE, TRUE);
Karsten Hopp e623a3
  	if (win_valid(last_curwin))
Karsten Hopp e623a3
  	    win_enter(last_curwin, FALSE);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
      /* to window with first arg */
Karsten Hopp e623a3
      if (valid_tabpage(new_curtab))
Karsten Hopp e623a3
! 	goto_tabpage_tp(new_curtab, TRUE, TRUE);
Karsten Hopp e623a3
      if (win_valid(new_curwin))
Karsten Hopp e623a3
  	win_enter(new_curwin, FALSE);
Karsten Hopp e623a3
  
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4825,4831 ****
Karsten Hopp e623a3
       */
Karsten Hopp e623a3
  #ifdef FEAT_WINDOWS
Karsten Hopp e623a3
      if (had_tab > 0)
Karsten Hopp e623a3
! 	goto_tabpage_tp(first_tabpage, TRUE);
Karsten Hopp e623a3
      for (;;)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
--- 4825,4831 ----
Karsten Hopp e623a3
       */
Karsten Hopp e623a3
  #ifdef FEAT_WINDOWS
Karsten Hopp e623a3
      if (had_tab > 0)
Karsten Hopp e623a3
! 	goto_tabpage_tp(first_tabpage, TRUE, TRUE);
Karsten Hopp e623a3
      for (;;)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4865,4871 ****
Karsten Hopp e623a3
  	/* Without the ":tab" modifier only do the current tab page. */
Karsten Hopp e623a3
  	if (had_tab == 0 || tpnext == NULL)
Karsten Hopp e623a3
  	    break;
Karsten Hopp e623a3
! 	goto_tabpage_tp(tpnext, TRUE);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  
Karsten Hopp e623a3
--- 4865,4871 ----
Karsten Hopp e623a3
  	/* Without the ":tab" modifier only do the current tab page. */
Karsten Hopp e623a3
  	if (had_tab == 0 || tpnext == NULL)
Karsten Hopp e623a3
  	    break;
Karsten Hopp e623a3
! 	goto_tabpage_tp(tpnext, TRUE, TRUE);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  
Karsten Hopp e623a3
*** ../vim-7.3.925/src/eval.c	2013-05-06 04:21:35.000000000 +0200
Karsten Hopp e623a3
--- src/eval.c	2013-05-06 04:33:13.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 16604,16610 ****
Karsten Hopp e623a3
      if (tp != NULL && varname != NULL && varp != NULL)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	save_curtab = curtab;
Karsten Hopp e623a3
! 	goto_tabpage_tp(tp, TRUE);
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  	tabvarname = alloc((unsigned)STRLEN(varname) + 3);
Karsten Hopp e623a3
  	if (tabvarname != NULL)
Karsten Hopp e623a3
--- 16604,16610 ----
Karsten Hopp e623a3
      if (tp != NULL && varname != NULL && varp != NULL)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	save_curtab = curtab;
Karsten Hopp e623a3
! 	goto_tabpage_tp(tp, FALSE, FALSE);
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  	tabvarname = alloc((unsigned)STRLEN(varname) + 3);
Karsten Hopp e623a3
  	if (tabvarname != NULL)
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 16617,16623 ****
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  	/* Restore current tabpage */
Karsten Hopp e623a3
  	if (valid_tabpage(save_curtab))
Karsten Hopp e623a3
! 	    goto_tabpage_tp(save_curtab, TRUE);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
--- 16617,16623 ----
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  	/* Restore current tabpage */
Karsten Hopp e623a3
  	if (valid_tabpage(save_curtab))
Karsten Hopp e623a3
! 	    goto_tabpage_tp(save_curtab, FALSE, FALSE);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 16654,16660 ****
Karsten Hopp e623a3
      /* set curwin to be our win, temporarily */
Karsten Hopp e623a3
      *save_curwin = curwin;
Karsten Hopp e623a3
      *save_curtab = curtab;
Karsten Hopp e623a3
!     goto_tabpage_tp(tp, TRUE);
Karsten Hopp e623a3
      if (!win_valid(win))
Karsten Hopp e623a3
  	return FAIL;
Karsten Hopp e623a3
      curwin = win;
Karsten Hopp e623a3
--- 16654,16660 ----
Karsten Hopp e623a3
      /* set curwin to be our win, temporarily */
Karsten Hopp e623a3
      *save_curwin = curwin;
Karsten Hopp e623a3
      *save_curtab = curtab;
Karsten Hopp e623a3
!     goto_tabpage_tp(tp, FALSE, FALSE);
Karsten Hopp e623a3
      if (!win_valid(win))
Karsten Hopp e623a3
  	return FAIL;
Karsten Hopp e623a3
      curwin = win;
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 16672,16678 ****
Karsten Hopp e623a3
      /* Restore current tabpage and window, if still valid (autocommands can
Karsten Hopp e623a3
       * make them invalid). */
Karsten Hopp e623a3
      if (valid_tabpage(save_curtab))
Karsten Hopp e623a3
! 	goto_tabpage_tp(save_curtab, TRUE);
Karsten Hopp e623a3
      if (win_valid(save_curwin))
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	curwin = save_curwin;
Karsten Hopp e623a3
--- 16672,16678 ----
Karsten Hopp e623a3
      /* Restore current tabpage and window, if still valid (autocommands can
Karsten Hopp e623a3
       * make them invalid). */
Karsten Hopp e623a3
      if (valid_tabpage(save_curtab))
Karsten Hopp e623a3
! 	goto_tabpage_tp(save_curtab, FALSE, FALSE);
Karsten Hopp e623a3
      if (win_valid(save_curwin))
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	curwin = save_curwin;
Karsten Hopp e623a3
*** ../vim-7.3.925/src/ex_cmds2.c	2013-05-06 04:21:35.000000000 +0200
Karsten Hopp e623a3
--- src/ex_cmds2.c	2013-05-06 04:33:13.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 2482,2488 ****
Karsten Hopp e623a3
  		/* go to window "tp" */
Karsten Hopp e623a3
  		if (!valid_tabpage(tp))
Karsten Hopp e623a3
  		    break;
Karsten Hopp e623a3
! 		goto_tabpage_tp(tp, TRUE);
Karsten Hopp e623a3
  		tp = tp->tp_next;
Karsten Hopp e623a3
  	    }
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
--- 2482,2488 ----
Karsten Hopp e623a3
  		/* go to window "tp" */
Karsten Hopp e623a3
  		if (!valid_tabpage(tp))
Karsten Hopp e623a3
  		    break;
Karsten Hopp e623a3
! 		goto_tabpage_tp(tp, TRUE, TRUE);
Karsten Hopp e623a3
  		tp = tp->tp_next;
Karsten Hopp e623a3
  	    }
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
*** ../vim-7.3.925/src/fileio.c	2013-05-06 04:21:35.000000000 +0200
Karsten Hopp e623a3
--- src/fileio.c	2013-05-06 04:33:13.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 8934,8940 ****
Karsten Hopp e623a3
  		if (wp == aucmd_win)
Karsten Hopp e623a3
  		{
Karsten Hopp e623a3
  		    if (tp != curtab)
Karsten Hopp e623a3
! 			goto_tabpage_tp(tp, TRUE);
Karsten Hopp e623a3
  		    win_goto(aucmd_win);
Karsten Hopp e623a3
  		    goto win_found;
Karsten Hopp e623a3
  		}
Karsten Hopp e623a3
--- 8934,8940 ----
Karsten Hopp e623a3
  		if (wp == aucmd_win)
Karsten Hopp e623a3
  		{
Karsten Hopp e623a3
  		    if (tp != curtab)
Karsten Hopp e623a3
! 			goto_tabpage_tp(tp, TRUE, TRUE);
Karsten Hopp e623a3
  		    win_goto(aucmd_win);
Karsten Hopp e623a3
  		    goto win_found;
Karsten Hopp e623a3
  		}
Karsten Hopp e623a3
*** ../vim-7.3.925/src/proto/window.pro	2012-07-19 18:05:40.000000000 +0200
Karsten Hopp e623a3
--- src/proto/window.pro	2013-05-06 04:33:13.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 27,33 ****
Karsten Hopp e623a3
  tabpage_T *find_tabpage __ARGS((int n));
Karsten Hopp e623a3
  int tabpage_index __ARGS((tabpage_T *ftp));
Karsten Hopp e623a3
  void goto_tabpage __ARGS((int n));
Karsten Hopp e623a3
! void goto_tabpage_tp __ARGS((tabpage_T *tp, int trigger_autocmds));
Karsten Hopp e623a3
  void goto_tabpage_win __ARGS((tabpage_T *tp, win_T *wp));
Karsten Hopp e623a3
  void tabpage_move __ARGS((int nr));
Karsten Hopp e623a3
  void win_goto __ARGS((win_T *wp));
Karsten Hopp e623a3
--- 27,33 ----
Karsten Hopp e623a3
  tabpage_T *find_tabpage __ARGS((int n));
Karsten Hopp e623a3
  int tabpage_index __ARGS((tabpage_T *ftp));
Karsten Hopp e623a3
  void goto_tabpage __ARGS((int n));
Karsten Hopp e623a3
! void goto_tabpage_tp __ARGS((tabpage_T *tp, int trigger_enter_autocmds, int trigger_leave_autocmds));
Karsten Hopp e623a3
  void goto_tabpage_win __ARGS((tabpage_T *tp, win_T *wp));
Karsten Hopp e623a3
  void tabpage_move __ARGS((int nr));
Karsten Hopp e623a3
  void win_goto __ARGS((win_T *wp));
Karsten Hopp e623a3
*** ../vim-7.3.925/src/testdir/test62.in	2012-07-06 18:27:34.000000000 +0200
Karsten Hopp e623a3
--- src/testdir/test62.in	2013-05-06 04:35:08.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 120,125 ****
Karsten Hopp e623a3
--- 120,187 ----
Karsten Hopp e623a3
  :endtry
Karsten Hopp e623a3
  i?=a
?
Karsten Hopp e623a3
  :"
Karsten Hopp e623a3
+ :" Test autocommands
Karsten Hopp e623a3
+ :tabonly!
Karsten Hopp e623a3
+ :let g:r=[]
Karsten Hopp e623a3
+ :command -nargs=1 -bar C :call add(g:r, '=== ' . <q-args> . ' ===')|<args>
Karsten Hopp e623a3
+ :function Test()
Karsten Hopp e623a3
+     let hasau=has('autocmd')
Karsten Hopp e623a3
+     if hasau
Karsten Hopp e623a3
+         autocmd TabEnter * :call add(g:r, 'TabEnter')
Karsten Hopp e623a3
+         autocmd WinEnter * :call add(g:r, 'WinEnter')
Karsten Hopp e623a3
+         autocmd BufEnter * :call add(g:r, 'BufEnter')
Karsten Hopp e623a3
+         autocmd TabLeave * :call add(g:r, 'TabLeave')
Karsten Hopp e623a3
+         autocmd WinLeave * :call add(g:r, 'WinLeave')
Karsten Hopp e623a3
+         autocmd BufLeave * :call add(g:r, 'BufLeave')
Karsten Hopp e623a3
+     endif
Karsten Hopp e623a3
+     let t:a='a'
Karsten Hopp e623a3
+     C tab split
Karsten Hopp e623a3
+     if !hasau
Karsten Hopp e623a3
+         let g:r+=['WinLeave', 'TabLeave', 'WinEnter', 'TabEnter']
Karsten Hopp e623a3
+     endif
Karsten Hopp e623a3
+     let t:a='b'
Karsten Hopp e623a3
+     C tabnew
Karsten Hopp e623a3
+     if !hasau
Karsten Hopp e623a3
+         let g:r+=['WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter']
Karsten Hopp e623a3
+     endif
Karsten Hopp e623a3
+     let t:a='c'
Karsten Hopp e623a3
+     call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')))
Karsten Hopp e623a3
+     C call map(range(1, tabpagenr('$')), 'settabvar(v:val, "a", v:val*2)')
Karsten Hopp e623a3
+     call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')))
Karsten Hopp e623a3
+     let w:a='a'
Karsten Hopp e623a3
+     C vsplit
Karsten Hopp e623a3
+     if !hasau
Karsten Hopp e623a3
+         let g:r+=['WinLeave', 'WinEnter']
Karsten Hopp e623a3
+     endif
Karsten Hopp e623a3
+     let w:a='a'
Karsten Hopp e623a3
+     let tabn=tabpagenr()
Karsten Hopp e623a3
+     let winr=range(1, winnr('$'))
Karsten Hopp e623a3
+     C tabnext 1
Karsten Hopp e623a3
+     if !hasau
Karsten Hopp e623a3
+         let g:r+=['BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter']
Karsten Hopp e623a3
+     endif
Karsten Hopp e623a3
+     call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')))
Karsten Hopp e623a3
+     C call map(copy(winr), 'settabwinvar('.tabn.', v:val, "a", v:val*2)')
Karsten Hopp e623a3
+     call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')))
Karsten Hopp e623a3
+     if hasau
Karsten Hopp e623a3
+         augroup TabDestructive
Karsten Hopp e623a3
+             autocmd TabEnter * :C tabnext 2 | C tabclose 3
Karsten Hopp e623a3
+         augroup END
Karsten Hopp e623a3
+         C tabnext 3
Karsten Hopp e623a3
+         let g:r+=[tabpagenr().'/'.tabpagenr('$')]
Karsten Hopp e623a3
+         autocmd! TabDestructive TabEnter
Karsten Hopp e623a3
+         C tabnew
Karsten Hopp e623a3
+         C tabnext 1
Karsten Hopp e623a3
+         autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3
Karsten Hopp e623a3
+         C tabnext 3
Karsten Hopp e623a3
+         let g:r+=[tabpagenr().'/'.tabpagenr('$')]
Karsten Hopp e623a3
+     else
Karsten Hopp e623a3
+         let g:r+=["=== tabnext 3 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","=== tabclose 3 ===","2/2","=== tabnew ===","WinLeave","TabLeave","WinEnter","TabEnter","BufLeave","BufEnter","=== tabnext 1 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","BufEnter","=== tabnext 3 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","=== tabclose 3 ===","BufEnter","=== tabclose 3 ===","2/2",]
Karsten Hopp e623a3
+     endif
Karsten Hopp e623a3
+ endfunction
Karsten Hopp e623a3
+ :call Test()
Karsten Hopp e623a3
+ :$ put =g:r
Karsten Hopp e623a3
+ :"
Karsten Hopp e623a3
  :"
Karsten Hopp e623a3
  :/^Results/,$w! test.out
Karsten Hopp e623a3
  :qa!
Karsten Hopp e623a3
*** ../vim-7.3.925/src/testdir/test62.ok	2012-07-06 18:27:34.000000000 +0200
Karsten Hopp e623a3
--- src/testdir/test62.ok	2013-05-06 04:35:08.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 18,20 ****
Karsten Hopp e623a3
--- 18,88 ----
Karsten Hopp e623a3
  4
Karsten Hopp e623a3
  6
Karsten Hopp e623a3
  E474 caught.
Karsten Hopp e623a3
+ === tab split ===
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ TabLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ TabEnter
Karsten Hopp e623a3
+ === tabnew ===
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ TabLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ TabEnter
Karsten Hopp e623a3
+ BufLeave
Karsten Hopp e623a3
+ BufEnter
Karsten Hopp e623a3
+ a b c
Karsten Hopp e623a3
+ === call map(range(1, tabpagenr('$')), 'settabvar(v:val, ===
Karsten Hopp e623a3
+ a b c
Karsten Hopp e623a3
+ === vsplit ===
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ === tabnext 1 ===
Karsten Hopp e623a3
+ BufLeave
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ TabLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ TabEnter
Karsten Hopp e623a3
+ BufEnter
Karsten Hopp e623a3
+ a a
Karsten Hopp e623a3
+ === call map(copy(winr), 'settabwinvar('.tabn.', v:val, ===
Karsten Hopp e623a3
+ a a
Karsten Hopp e623a3
+ === tabnext 3 ===
Karsten Hopp e623a3
+ BufLeave
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ TabLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ TabEnter
Karsten Hopp e623a3
+ === tabnext 2 ===
Karsten Hopp e623a3
+ === tabclose 3 ===
Karsten Hopp e623a3
+ 2/2
Karsten Hopp e623a3
+ === tabnew ===
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ TabLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ TabEnter
Karsten Hopp e623a3
+ BufLeave
Karsten Hopp e623a3
+ BufEnter
Karsten Hopp e623a3
+ === tabnext 1 ===
Karsten Hopp e623a3
+ BufLeave
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ TabLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ TabEnter
Karsten Hopp e623a3
+ BufEnter
Karsten Hopp e623a3
+ === tabnext 3 ===
Karsten Hopp e623a3
+ BufLeave
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ TabLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ TabEnter
Karsten Hopp e623a3
+ === tabnext 2 ===
Karsten Hopp e623a3
+ BufLeave
Karsten Hopp e623a3
+ WinLeave
Karsten Hopp e623a3
+ TabLeave
Karsten Hopp e623a3
+ WinEnter
Karsten Hopp e623a3
+ TabEnter
Karsten Hopp e623a3
+ === tabnext 2 ===
Karsten Hopp e623a3
+ === tabclose 3 ===
Karsten Hopp e623a3
+ BufEnter
Karsten Hopp e623a3
+ === tabclose 3 ===
Karsten Hopp e623a3
+ 2/2
Karsten Hopp e623a3
*** ../vim-7.3.925/src/window.c	2013-05-06 04:21:35.000000000 +0200
Karsten Hopp e623a3
--- src/window.c	2013-05-06 04:47:06.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 44,54 ****
Karsten Hopp e623a3
  static void new_frame __ARGS((win_T *wp));
Karsten Hopp e623a3
  #if defined(FEAT_WINDOWS) || defined(PROTO)
Karsten Hopp e623a3
  static tabpage_T *alloc_tabpage __ARGS((void));
Karsten Hopp e623a3
! static int leave_tabpage __ARGS((buf_T *new_curbuf));
Karsten Hopp e623a3
! static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf, int trigger_autocmds));
Karsten Hopp e623a3
  static void frame_fix_height __ARGS((win_T *wp));
Karsten Hopp e623a3
  static int frame_minheight __ARGS((frame_T *topfrp, win_T *next_curwin));
Karsten Hopp e623a3
! static void win_enter_ext __ARGS((win_T *wp, int undo_sync, int no_curwin));
Karsten Hopp e623a3
  static void win_free __ARGS((win_T *wp, tabpage_T *tp));
Karsten Hopp e623a3
  static void frame_append __ARGS((frame_T *after, frame_T *frp));
Karsten Hopp e623a3
  static void frame_insert __ARGS((frame_T *before, frame_T *frp));
Karsten Hopp e623a3
--- 44,54 ----
Karsten Hopp e623a3
  static void new_frame __ARGS((win_T *wp));
Karsten Hopp e623a3
  #if defined(FEAT_WINDOWS) || defined(PROTO)
Karsten Hopp e623a3
  static tabpage_T *alloc_tabpage __ARGS((void));
Karsten Hopp e623a3
! static int leave_tabpage __ARGS((buf_T *new_curbuf, int trigger_leave_autocmds));
Karsten Hopp e623a3
! static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_autocmds, int trigger_leave_autocmds));
Karsten Hopp e623a3
  static void frame_fix_height __ARGS((win_T *wp));
Karsten Hopp e623a3
  static int frame_minheight __ARGS((frame_T *topfrp, win_T *next_curwin));
Karsten Hopp e623a3
! static void win_enter_ext __ARGS((win_T *wp, int undo_sync, int no_curwin, int trigger_enter_autocmds, int trigger_leave_autocmds));
Karsten Hopp e623a3
  static void win_free __ARGS((win_T *wp, tabpage_T *tp));
Karsten Hopp e623a3
  static void frame_append __ARGS((frame_T *after, frame_T *frp));
Karsten Hopp e623a3
  static void frame_insert __ARGS((frame_T *before, frame_T *frp));
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 353,363 ****
Karsten Hopp e623a3
  						     && valid_tabpage(oldtab))
Karsten Hopp e623a3
  		    {
Karsten Hopp e623a3
  			newtab = curtab;
Karsten Hopp e623a3
! 			goto_tabpage_tp(oldtab, TRUE);
Karsten Hopp e623a3
  			if (curwin == wp)
Karsten Hopp e623a3
  			    win_close(curwin, FALSE);
Karsten Hopp e623a3
  			if (valid_tabpage(newtab))
Karsten Hopp e623a3
! 			    goto_tabpage_tp(newtab, TRUE);
Karsten Hopp e623a3
  		    }
Karsten Hopp e623a3
  		}
Karsten Hopp e623a3
  		break;
Karsten Hopp e623a3
--- 353,363 ----
Karsten Hopp e623a3
  						     && valid_tabpage(oldtab))
Karsten Hopp e623a3
  		    {
Karsten Hopp e623a3
  			newtab = curtab;
Karsten Hopp e623a3
! 			goto_tabpage_tp(oldtab, TRUE, TRUE);
Karsten Hopp e623a3
  			if (curwin == wp)
Karsten Hopp e623a3
  			    win_close(curwin, FALSE);
Karsten Hopp e623a3
  			if (valid_tabpage(newtab))
Karsten Hopp e623a3
! 			    goto_tabpage_tp(newtab, TRUE, TRUE);
Karsten Hopp e623a3
  		    }
Karsten Hopp e623a3
  		}
Karsten Hopp e623a3
  		break;
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 2124,2129 ****
Karsten Hopp e623a3
--- 2124,2131 ----
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
      if (firstwin == lastwin)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
+ 	buf_T	*old_curbuf = curbuf;
Karsten Hopp e623a3
+ 
Karsten Hopp e623a3
  	/*
Karsten Hopp e623a3
  	 * Closing the last window in a tab page.  First go to another tab
Karsten Hopp e623a3
  	 * page and then close the window and the tab page.  This avoids that
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 2132,2138 ****
Karsten Hopp e623a3
  	 * Don't trigger autocommands yet, they may use wrong values, so do
Karsten Hopp e623a3
  	 * that below.
Karsten Hopp e623a3
  	 */
Karsten Hopp e623a3
! 	goto_tabpage_tp(alt_tabpage(), FALSE);
Karsten Hopp e623a3
  	redraw_tabline = TRUE;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  	/* Safety check: Autocommands may have closed the window when jumping
Karsten Hopp e623a3
--- 2134,2140 ----
Karsten Hopp e623a3
  	 * Don't trigger autocommands yet, they may use wrong values, so do
Karsten Hopp e623a3
  	 * that below.
Karsten Hopp e623a3
  	 */
Karsten Hopp e623a3
! 	goto_tabpage_tp(alt_tabpage(), FALSE, TRUE);
Karsten Hopp e623a3
  	redraw_tabline = TRUE;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  	/* Safety check: Autocommands may have closed the window when jumping
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 2148,2155 ****
Karsten Hopp e623a3
  	/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do
Karsten Hopp e623a3
  	 * that now. */
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
- 	apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  	apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  	return TRUE;
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
--- 2150,2159 ----
Karsten Hopp e623a3
  	/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do
Karsten Hopp e623a3
  	 * that now. */
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
  	apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
+ 	apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
+ 	if (old_curbuf != curbuf)
Karsten Hopp e623a3
+ 	    apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  	return TRUE;
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 2341,2347 ****
Karsten Hopp e623a3
  	win_comp_pos();
Karsten Hopp e623a3
      if (close_curwin)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
! 	win_enter_ext(wp, FALSE, TRUE);
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
  	if (other_buffer)
Karsten Hopp e623a3
  	    /* careful: after this wp and win may be invalid! */
Karsten Hopp e623a3
--- 2345,2351 ----
Karsten Hopp e623a3
  	win_comp_pos();
Karsten Hopp e623a3
      if (close_curwin)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
! 	win_enter_ext(wp, FALSE, TRUE, TRUE, TRUE);
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
  	if (other_buffer)
Karsten Hopp e623a3
  	    /* careful: after this wp and win may be invalid! */
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3529,3535 ****
Karsten Hopp e623a3
  	return FAIL;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
      /* Remember the current windows in this Tab page. */
Karsten Hopp e623a3
!     if (leave_tabpage(curbuf) == FAIL)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	vim_free(newtp);
Karsten Hopp e623a3
  	return FAIL;
Karsten Hopp e623a3
--- 3533,3539 ----
Karsten Hopp e623a3
  	return FAIL;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
      /* Remember the current windows in this Tab page. */
Karsten Hopp e623a3
!     if (leave_tabpage(curbuf, TRUE) == FAIL)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	vim_free(newtp);
Karsten Hopp e623a3
  	return FAIL;
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3574,3587 ****
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  	redraw_all_later(CLEAR);
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
- 	apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  	apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  	return OK;
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
      /* Failed, get back the previous Tab page */
Karsten Hopp e623a3
!     enter_tabpage(curtab, curbuf, TRUE);
Karsten Hopp e623a3
      return FAIL;
Karsten Hopp e623a3
  }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
--- 3578,3591 ----
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  	redraw_all_later(CLEAR);
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
  	apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
+ 	apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  	return OK;
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
      /* Failed, get back the previous Tab page */
Karsten Hopp e623a3
!     enter_tabpage(curtab, curbuf, TRUE, TRUE);
Karsten Hopp e623a3
      return FAIL;
Karsten Hopp e623a3
  }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3692,3700 ****
Karsten Hopp e623a3
   * Careful: When OK is returned need to get a new tab page very very soon!
Karsten Hopp e623a3
   */
Karsten Hopp e623a3
      static int
Karsten Hopp e623a3
! leave_tabpage(new_curbuf)
Karsten Hopp e623a3
      buf_T	*new_curbuf UNUSED;    /* what is going to be the new curbuf,
Karsten Hopp e623a3
  				       NULL if unknown */
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
      tabpage_T	*tp = curtab;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
--- 3696,3705 ----
Karsten Hopp e623a3
   * Careful: When OK is returned need to get a new tab page very very soon!
Karsten Hopp e623a3
   */
Karsten Hopp e623a3
      static int
Karsten Hopp e623a3
! leave_tabpage(new_curbuf, trigger_leave_autocmds)
Karsten Hopp e623a3
      buf_T	*new_curbuf UNUSED;    /* what is going to be the new curbuf,
Karsten Hopp e623a3
  				       NULL if unknown */
Karsten Hopp e623a3
+     int		trigger_leave_autocmds UNUSED;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
      tabpage_T	*tp = curtab;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3702,3719 ****
Karsten Hopp e623a3
      reset_VIsual_and_resel();	/* stop Visual mode */
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
!     if (new_curbuf != curbuf)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
! 	apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  	if (curtab != tp)
Karsten Hopp e623a3
  	    return FAIL;
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
-     apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
-     if (curtab != tp)
Karsten Hopp e623a3
- 	return FAIL;
Karsten Hopp e623a3
-     apply_autocmds(EVENT_TABLEAVE, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
-     if (curtab != tp)
Karsten Hopp e623a3
- 	return FAIL;
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  #if defined(FEAT_GUI)
Karsten Hopp e623a3
      /* Remove the scrollbars.  They may be added back later. */
Karsten Hopp e623a3
--- 3707,3727 ----
Karsten Hopp e623a3
      reset_VIsual_and_resel();	/* stop Visual mode */
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
!     if (trigger_leave_autocmds)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
! 	if (new_curbuf != curbuf)
Karsten Hopp e623a3
! 	{
Karsten Hopp e623a3
! 	    apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
! 	    if (curtab != tp)
Karsten Hopp e623a3
! 		return FAIL;
Karsten Hopp e623a3
! 	}
Karsten Hopp e623a3
! 	apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
! 	if (curtab != tp)
Karsten Hopp e623a3
! 	    return FAIL;
Karsten Hopp e623a3
! 	apply_autocmds(EVENT_TABLEAVE, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  	if (curtab != tp)
Karsten Hopp e623a3
  	    return FAIL;
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  #if defined(FEAT_GUI)
Karsten Hopp e623a3
      /* Remove the scrollbars.  They may be added back later. */
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3734,3746 ****
Karsten Hopp e623a3
  /*
Karsten Hopp e623a3
   * Start using tab page "tp".
Karsten Hopp e623a3
   * Only to be used after leave_tabpage() or freeing the current tab page.
Karsten Hopp e623a3
!  * Only trigger *Enter autocommands when trigger_autocmds is TRUE.
Karsten Hopp e623a3
   */
Karsten Hopp e623a3
      static void
Karsten Hopp e623a3
! enter_tabpage(tp, old_curbuf, trigger_autocmds)
Karsten Hopp e623a3
      tabpage_T	*tp;
Karsten Hopp e623a3
      buf_T	*old_curbuf UNUSED;
Karsten Hopp e623a3
!     int		trigger_autocmds UNUSED;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
      int		old_off = tp->tp_firstwin->w_winrow;
Karsten Hopp e623a3
      win_T	*next_prevwin = tp->tp_prevwin;
Karsten Hopp e623a3
--- 3742,3756 ----
Karsten Hopp e623a3
  /*
Karsten Hopp e623a3
   * Start using tab page "tp".
Karsten Hopp e623a3
   * Only to be used after leave_tabpage() or freeing the current tab page.
Karsten Hopp e623a3
!  * Only trigger *Enter autocommands when trigger_enter_autocmds is TRUE.
Karsten Hopp e623a3
!  * Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE.
Karsten Hopp e623a3
   */
Karsten Hopp e623a3
      static void
Karsten Hopp e623a3
! enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds)
Karsten Hopp e623a3
      tabpage_T	*tp;
Karsten Hopp e623a3
      buf_T	*old_curbuf UNUSED;
Karsten Hopp e623a3
!     int		trigger_enter_autocmds UNUSED;
Karsten Hopp e623a3
!     int		trigger_leave_autocmds UNUSED;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
      int		old_off = tp->tp_firstwin->w_winrow;
Karsten Hopp e623a3
      win_T	*next_prevwin = tp->tp_prevwin;
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3753,3759 ****
Karsten Hopp e623a3
      /* We would like doing the TabEnter event first, but we don't have a
Karsten Hopp e623a3
       * valid current window yet, which may break some commands.
Karsten Hopp e623a3
       * This triggers autocommands, thus may make "tp" invalid. */
Karsten Hopp e623a3
!     win_enter_ext(tp->tp_curwin, FALSE, TRUE);
Karsten Hopp e623a3
      prevwin = next_prevwin;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
      last_status(FALSE);		/* status line may appear or disappear */
Karsten Hopp e623a3
--- 3763,3769 ----
Karsten Hopp e623a3
      /* We would like doing the TabEnter event first, but we don't have a
Karsten Hopp e623a3
       * valid current window yet, which may break some commands.
Karsten Hopp e623a3
       * This triggers autocommands, thus may make "tp" invalid. */
Karsten Hopp e623a3
!     win_enter_ext(tp->tp_curwin, FALSE, TRUE, trigger_enter_autocmds, trigger_leave_autocmds);
Karsten Hopp e623a3
      prevwin = next_prevwin;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
      last_status(FALSE);		/* status line may appear or disappear */
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3788,3794 ****
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
      /* Apply autocommands after updating the display, when 'rows' and
Karsten Hopp e623a3
       * 'columns' have been set correctly. */
Karsten Hopp e623a3
!     if (trigger_autocmds)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  	if (old_curbuf != curbuf)
Karsten Hopp e623a3
--- 3798,3804 ----
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
      /* Apply autocommands after updating the display, when 'rows' and
Karsten Hopp e623a3
       * 'columns' have been set correctly. */
Karsten Hopp e623a3
!     if (trigger_enter_autocmds)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  	if (old_curbuf != curbuf)
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3869,3875 ****
Karsten Hopp e623a3
  	}
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
!     goto_tabpage_tp(tp, TRUE);
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  #ifdef FEAT_GUI_TABLINE
Karsten Hopp e623a3
      if (gui_use_tabline())
Karsten Hopp e623a3
--- 3879,3885 ----
Karsten Hopp e623a3
  	}
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
!     goto_tabpage_tp(tp, TRUE, TRUE);
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  #ifdef FEAT_GUI_TABLINE
Karsten Hopp e623a3
      if (gui_use_tabline())
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3879,3901 ****
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  /*
Karsten Hopp e623a3
   * Go to tabpage "tp".
Karsten Hopp e623a3
!  * Only trigger *Enter autocommands when trigger_autocmds is TRUE.
Karsten Hopp e623a3
   * Note: doesn't update the GUI tab.
Karsten Hopp e623a3
   */
Karsten Hopp e623a3
      void
Karsten Hopp e623a3
! goto_tabpage_tp(tp, trigger_autocmds)
Karsten Hopp e623a3
      tabpage_T	*tp;
Karsten Hopp e623a3
!     int		trigger_autocmds;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
      /* Don't repeat a message in another tab page. */
Karsten Hopp e623a3
      set_keep_msg(NULL, 0);
Karsten Hopp e623a3
  
Karsten Hopp e623a3
!     if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer) == OK)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	if (valid_tabpage(tp))
Karsten Hopp e623a3
! 	    enter_tabpage(tp, curbuf, trigger_autocmds);
Karsten Hopp e623a3
  	else
Karsten Hopp e623a3
! 	    enter_tabpage(curtab, curbuf, trigger_autocmds);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
--- 3889,3916 ----
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  /*
Karsten Hopp e623a3
   * Go to tabpage "tp".
Karsten Hopp e623a3
!  * Only trigger *Enter autocommands when trigger_enter_autocmds is TRUE.
Karsten Hopp e623a3
!  * Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE.
Karsten Hopp e623a3
   * Note: doesn't update the GUI tab.
Karsten Hopp e623a3
   */
Karsten Hopp e623a3
      void
Karsten Hopp e623a3
! goto_tabpage_tp(tp, trigger_enter_autocmds, trigger_leave_autocmds)
Karsten Hopp e623a3
      tabpage_T	*tp;
Karsten Hopp e623a3
!     int		trigger_enter_autocmds;
Karsten Hopp e623a3
!     int		trigger_leave_autocmds;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
      /* Don't repeat a message in another tab page. */
Karsten Hopp e623a3
      set_keep_msg(NULL, 0);
Karsten Hopp e623a3
  
Karsten Hopp e623a3
!     if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer,
Karsten Hopp e623a3
! 					trigger_leave_autocmds) == OK)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	if (valid_tabpage(tp))
Karsten Hopp e623a3
! 	    enter_tabpage(tp, curbuf, trigger_enter_autocmds,
Karsten Hopp e623a3
! 		    trigger_leave_autocmds);
Karsten Hopp e623a3
  	else
Karsten Hopp e623a3
! 	    enter_tabpage(curtab, curbuf, trigger_enter_autocmds,
Karsten Hopp e623a3
! 		    trigger_leave_autocmds);
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 3908,3914 ****
Karsten Hopp e623a3
      tabpage_T	*tp;
Karsten Hopp e623a3
      win_T	*wp;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
!     goto_tabpage_tp(tp, TRUE);
Karsten Hopp e623a3
      if (curtab == tp && win_valid(wp))
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	win_enter(wp, TRUE);
Karsten Hopp e623a3
--- 3923,3929 ----
Karsten Hopp e623a3
      tabpage_T	*tp;
Karsten Hopp e623a3
      win_T	*wp;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
!     goto_tabpage_tp(tp, TRUE, TRUE);
Karsten Hopp e623a3
      if (curtab == tp && win_valid(wp))
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	win_enter(wp, TRUE);
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4168,4174 ****
Karsten Hopp e623a3
      win_T	*wp;
Karsten Hopp e623a3
      int		undo_sync;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
!     win_enter_ext(wp, undo_sync, FALSE);
Karsten Hopp e623a3
  }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  /*
Karsten Hopp e623a3
--- 4183,4189 ----
Karsten Hopp e623a3
      win_T	*wp;
Karsten Hopp e623a3
      int		undo_sync;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
!     win_enter_ext(wp, undo_sync, FALSE, TRUE, TRUE);
Karsten Hopp e623a3
  }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  /*
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4177,4186 ****
Karsten Hopp e623a3
   * been closed and isn't valid.
Karsten Hopp e623a3
   */
Karsten Hopp e623a3
      static void
Karsten Hopp e623a3
! win_enter_ext(wp, undo_sync, curwin_invalid)
Karsten Hopp e623a3
      win_T	*wp;
Karsten Hopp e623a3
      int		undo_sync;
Karsten Hopp e623a3
      int		curwin_invalid;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
      int		other_buffer = FALSE;
Karsten Hopp e623a3
--- 4192,4203 ----
Karsten Hopp e623a3
   * been closed and isn't valid.
Karsten Hopp e623a3
   */
Karsten Hopp e623a3
      static void
Karsten Hopp e623a3
! win_enter_ext(wp, undo_sync, curwin_invalid, trigger_enter_autocmds, trigger_leave_autocmds)
Karsten Hopp e623a3
      win_T	*wp;
Karsten Hopp e623a3
      int		undo_sync;
Karsten Hopp e623a3
      int		curwin_invalid;
Karsten Hopp e623a3
+     int		trigger_enter_autocmds UNUSED;
Karsten Hopp e623a3
+     int		trigger_leave_autocmds UNUSED;
Karsten Hopp e623a3
  {
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
      int		other_buffer = FALSE;
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4190,4196 ****
Karsten Hopp e623a3
  	return;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
!     if (!curwin_invalid)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	/*
Karsten Hopp e623a3
  	 * Be careful: If autocommands delete the window, return now.
Karsten Hopp e623a3
--- 4207,4213 ----
Karsten Hopp e623a3
  	return;
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
!     if (!curwin_invalid && trigger_leave_autocmds)
Karsten Hopp e623a3
      {
Karsten Hopp e623a3
  	/*
Karsten Hopp e623a3
  	 * Be careful: If autocommands delete the window, return now.
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 4259,4267 ****
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
!     apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
!     if (other_buffer)
Karsten Hopp e623a3
! 	apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  #ifdef FEAT_TITLE
Karsten Hopp e623a3
--- 4276,4287 ----
Karsten Hopp e623a3
      }
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  #ifdef FEAT_AUTOCMD
Karsten Hopp e623a3
!     if (trigger_enter_autocmds)
Karsten Hopp e623a3
!     {
Karsten Hopp e623a3
! 	apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
! 	if (other_buffer)
Karsten Hopp e623a3
! 	    apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp e623a3
!     }
Karsten Hopp e623a3
  #endif
Karsten Hopp e623a3
  
Karsten Hopp e623a3
  #ifdef FEAT_TITLE
Karsten Hopp e623a3
*** ../vim-7.3.925/src/version.c	2013-05-06 04:21:35.000000000 +0200
Karsten Hopp e623a3
--- src/version.c	2013-05-06 04:40:52.000000000 +0200
Karsten Hopp e623a3
***************
Karsten Hopp e623a3
*** 730,731 ****
Karsten Hopp e623a3
--- 730,733 ----
Karsten Hopp e623a3
  {   /* Add new patch number below this line */
Karsten Hopp e623a3
+ /**/
Karsten Hopp e623a3
+     926,
Karsten Hopp e623a3
  /**/
Karsten Hopp e623a3
Karsten Hopp e623a3
-- 
Karsten Hopp e623a3
       Bravely bold Sir Robin, rode forth from Camelot,
Karsten Hopp e623a3
       He was not afraid to die, Oh Brave Sir Robin,
Karsten Hopp e623a3
       He was not at all afraid to be killed in nasty ways
Karsten Hopp e623a3
       Brave, brave, brave, brave Sir Robin.
Karsten Hopp e623a3
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp e623a3
Karsten Hopp e623a3
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp e623a3
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp e623a3
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp e623a3
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///