Karsten Hopp f5d2c4
To: vim_dev@googlegroups.com
Karsten Hopp f5d2c4
Subject: Patch 7.3.551
Karsten Hopp f5d2c4
Fcc: outbox
Karsten Hopp f5d2c4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp f5d2c4
Mime-Version: 1.0
Karsten Hopp f5d2c4
Content-Type: text/plain; charset=UTF-8
Karsten Hopp f5d2c4
Content-Transfer-Encoding: 8bit
Karsten Hopp f5d2c4
------------
Karsten Hopp f5d2c4
Karsten Hopp f5d2c4
Patch 7.3.551
Karsten Hopp f5d2c4
Problem:    When using :tablose a TabEnter autocommand is triggered too early.
Karsten Hopp f5d2c4
	    (Karthick)
Karsten Hopp f5d2c4
Solution:   Don't trigger *Enter autocommands before closing the tab.
Karsten Hopp f5d2c4
	    (Christian Brabandt)
Karsten Hopp f5d2c4
Files:	    src/buffer.c, src/eval.c, src/ex_cmds2.c, src/fileio.c,
Karsten Hopp f5d2c4
	    src/proto/window.pro, src/window.c
Karsten Hopp f5d2c4
Karsten Hopp f5d2c4
Karsten Hopp f5d2c4
*** ../vim-7.3.550/src/buffer.c	2012-06-06 19:02:40.000000000 +0200
Karsten Hopp f5d2c4
--- src/buffer.c	2012-06-13 14:18:58.000000000 +0200
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 4470,4476 ****
Karsten Hopp f5d2c4
       * When the ":tab" modifier was used do this for all tab pages.
Karsten Hopp f5d2c4
       */
Karsten Hopp f5d2c4
      if (had_tab > 0)
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(first_tabpage);
Karsten Hopp f5d2c4
      for (;;)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	tpnext = curtab->tp_next;
Karsten Hopp f5d2c4
--- 4470,4476 ----
Karsten Hopp f5d2c4
       * When the ":tab" modifier was used do this for all tab pages.
Karsten Hopp f5d2c4
       */
Karsten Hopp f5d2c4
      if (had_tab > 0)
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(first_tabpage, TRUE);
Karsten Hopp f5d2c4
      for (;;)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	tpnext = curtab->tp_next;
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 4582,4588 ****
Karsten Hopp f5d2c4
  	if (!valid_tabpage(tpnext))
Karsten Hopp f5d2c4
  	    tpnext = first_tabpage;	/* start all over...*/
Karsten Hopp f5d2c4
  # endif
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(tpnext);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
      /*
Karsten Hopp f5d2c4
--- 4582,4588 ----
Karsten Hopp f5d2c4
  	if (!valid_tabpage(tpnext))
Karsten Hopp f5d2c4
  	    tpnext = first_tabpage;	/* start all over...*/
Karsten Hopp f5d2c4
  # endif
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(tpnext, TRUE);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
      /*
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 4686,4698 ****
Karsten Hopp f5d2c4
      if (last_curtab != new_curtab)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	if (valid_tabpage(last_curtab))
Karsten Hopp f5d2c4
! 	    goto_tabpage_tp(last_curtab);
Karsten Hopp f5d2c4
  	if (win_valid(last_curwin))
Karsten Hopp f5d2c4
  	    win_enter(last_curwin, FALSE);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
      /* to window with first arg */
Karsten Hopp f5d2c4
      if (valid_tabpage(new_curtab))
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(new_curtab);
Karsten Hopp f5d2c4
      if (win_valid(new_curwin))
Karsten Hopp f5d2c4
  	win_enter(new_curwin, FALSE);
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
--- 4686,4698 ----
Karsten Hopp f5d2c4
      if (last_curtab != new_curtab)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	if (valid_tabpage(last_curtab))
Karsten Hopp f5d2c4
! 	    goto_tabpage_tp(last_curtab, TRUE);
Karsten Hopp f5d2c4
  	if (win_valid(last_curwin))
Karsten Hopp f5d2c4
  	    win_enter(last_curwin, FALSE);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
      /* to window with first arg */
Karsten Hopp f5d2c4
      if (valid_tabpage(new_curtab))
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(new_curtab, TRUE);
Karsten Hopp f5d2c4
      if (win_valid(new_curwin))
Karsten Hopp f5d2c4
  	win_enter(new_curwin, FALSE);
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 4744,4750 ****
Karsten Hopp f5d2c4
       */
Karsten Hopp f5d2c4
  #ifdef FEAT_WINDOWS
Karsten Hopp f5d2c4
      if (had_tab > 0)
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(first_tabpage);
Karsten Hopp f5d2c4
      for (;;)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  #endif
Karsten Hopp f5d2c4
--- 4744,4750 ----
Karsten Hopp f5d2c4
       */
Karsten Hopp f5d2c4
  #ifdef FEAT_WINDOWS
Karsten Hopp f5d2c4
      if (had_tab > 0)
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(first_tabpage, TRUE);
Karsten Hopp f5d2c4
      for (;;)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  #endif
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 4784,4790 ****
Karsten Hopp f5d2c4
  	/* Without the ":tab" modifier only do the current tab page. */
Karsten Hopp f5d2c4
  	if (had_tab == 0 || tpnext == NULL)
Karsten Hopp f5d2c4
  	    break;
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(tpnext);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  #endif
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
--- 4784,4790 ----
Karsten Hopp f5d2c4
  	/* Without the ":tab" modifier only do the current tab page. */
Karsten Hopp f5d2c4
  	if (had_tab == 0 || tpnext == NULL)
Karsten Hopp f5d2c4
  	    break;
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(tpnext, TRUE);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  #endif
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
*** ../vim-7.3.550/src/eval.c	2012-06-06 16:29:06.000000000 +0200
Karsten Hopp f5d2c4
--- src/eval.c	2012-06-13 14:18:58.000000000 +0200
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 16415,16421 ****
Karsten Hopp f5d2c4
      if (tp != NULL && varname != NULL && varp != NULL)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	save_curtab = curtab;
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(tp);
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  	tabvarname = alloc((unsigned)STRLEN(varname) + 3);
Karsten Hopp f5d2c4
  	if (tabvarname != NULL)
Karsten Hopp f5d2c4
--- 16415,16421 ----
Karsten Hopp f5d2c4
      if (tp != NULL && varname != NULL && varp != NULL)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	save_curtab = curtab;
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(tp, TRUE);
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  	tabvarname = alloc((unsigned)STRLEN(varname) + 3);
Karsten Hopp f5d2c4
  	if (tabvarname != NULL)
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 16428,16434 ****
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  	/* Restore current tabpage */
Karsten Hopp f5d2c4
  	if (valid_tabpage(save_curtab))
Karsten Hopp f5d2c4
! 	    goto_tabpage_tp(save_curtab);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
--- 16428,16434 ----
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  	/* Restore current tabpage */
Karsten Hopp f5d2c4
  	if (valid_tabpage(save_curtab))
Karsten Hopp f5d2c4
! 	    goto_tabpage_tp(save_curtab, TRUE);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 16492,16498 ****
Karsten Hopp f5d2c4
  	/* set curwin to be our win, temporarily */
Karsten Hopp f5d2c4
  	save_curwin = curwin;
Karsten Hopp f5d2c4
  	save_curtab = curtab;
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(tp);
Karsten Hopp f5d2c4
  	if (!win_valid(win))
Karsten Hopp f5d2c4
  	    return;
Karsten Hopp f5d2c4
  	curwin = win;
Karsten Hopp f5d2c4
--- 16492,16498 ----
Karsten Hopp f5d2c4
  	/* set curwin to be our win, temporarily */
Karsten Hopp f5d2c4
  	save_curwin = curwin;
Karsten Hopp f5d2c4
  	save_curtab = curtab;
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(tp, TRUE);
Karsten Hopp f5d2c4
  	if (!win_valid(win))
Karsten Hopp f5d2c4
  	    return;
Karsten Hopp f5d2c4
  	curwin = win;
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 16527,16533 ****
Karsten Hopp f5d2c4
  	/* Restore current tabpage and window, if still valid (autocomands can
Karsten Hopp f5d2c4
  	 * make them invalid). */
Karsten Hopp f5d2c4
  	if (valid_tabpage(save_curtab))
Karsten Hopp f5d2c4
! 	    goto_tabpage_tp(save_curtab);
Karsten Hopp f5d2c4
  	if (win_valid(save_curwin))
Karsten Hopp f5d2c4
  	{
Karsten Hopp f5d2c4
  	    curwin = save_curwin;
Karsten Hopp f5d2c4
--- 16527,16533 ----
Karsten Hopp f5d2c4
  	/* Restore current tabpage and window, if still valid (autocomands can
Karsten Hopp f5d2c4
  	 * make them invalid). */
Karsten Hopp f5d2c4
  	if (valid_tabpage(save_curtab))
Karsten Hopp f5d2c4
! 	    goto_tabpage_tp(save_curtab, TRUE);
Karsten Hopp f5d2c4
  	if (win_valid(save_curwin))
Karsten Hopp f5d2c4
  	{
Karsten Hopp f5d2c4
  	    curwin = save_curwin;
Karsten Hopp f5d2c4
*** ../vim-7.3.550/src/ex_cmds2.c	2012-04-25 17:32:14.000000000 +0200
Karsten Hopp f5d2c4
--- src/ex_cmds2.c	2012-06-13 14:18:58.000000000 +0200
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 2476,2482 ****
Karsten Hopp f5d2c4
  		/* go to window "tp" */
Karsten Hopp f5d2c4
  		if (!valid_tabpage(tp))
Karsten Hopp f5d2c4
  		    break;
Karsten Hopp f5d2c4
! 		goto_tabpage_tp(tp);
Karsten Hopp f5d2c4
  		tp = tp->tp_next;
Karsten Hopp f5d2c4
  	    }
Karsten Hopp f5d2c4
  #endif
Karsten Hopp f5d2c4
--- 2476,2482 ----
Karsten Hopp f5d2c4
  		/* go to window "tp" */
Karsten Hopp f5d2c4
  		if (!valid_tabpage(tp))
Karsten Hopp f5d2c4
  		    break;
Karsten Hopp f5d2c4
! 		goto_tabpage_tp(tp, TRUE);
Karsten Hopp f5d2c4
  		tp = tp->tp_next;
Karsten Hopp f5d2c4
  	    }
Karsten Hopp f5d2c4
  #endif
Karsten Hopp f5d2c4
*** ../vim-7.3.550/src/fileio.c	2012-06-06 18:03:01.000000000 +0200
Karsten Hopp f5d2c4
--- src/fileio.c	2012-06-13 14:18:58.000000000 +0200
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 8918,8924 ****
Karsten Hopp f5d2c4
  		if (wp == aucmd_win)
Karsten Hopp f5d2c4
  		{
Karsten Hopp f5d2c4
  		    if (tp != curtab)
Karsten Hopp f5d2c4
! 			goto_tabpage_tp(tp);
Karsten Hopp f5d2c4
  		    win_goto(aucmd_win);
Karsten Hopp f5d2c4
  		    goto win_found;
Karsten Hopp f5d2c4
  		}
Karsten Hopp f5d2c4
--- 8918,8924 ----
Karsten Hopp f5d2c4
  		if (wp == aucmd_win)
Karsten Hopp f5d2c4
  		{
Karsten Hopp f5d2c4
  		    if (tp != curtab)
Karsten Hopp f5d2c4
! 			goto_tabpage_tp(tp, TRUE);
Karsten Hopp f5d2c4
  		    win_goto(aucmd_win);
Karsten Hopp f5d2c4
  		    goto win_found;
Karsten Hopp f5d2c4
  		}
Karsten Hopp f5d2c4
*** ../vim-7.3.550/src/proto/window.pro	2012-02-22 14:58:24.000000000 +0100
Karsten Hopp f5d2c4
--- src/proto/window.pro	2012-06-13 14:23:06.000000000 +0200
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 27,33 ****
Karsten Hopp f5d2c4
  tabpage_T *find_tabpage __ARGS((int n));
Karsten Hopp f5d2c4
  int tabpage_index __ARGS((tabpage_T *ftp));
Karsten Hopp f5d2c4
  void goto_tabpage __ARGS((int n));
Karsten Hopp f5d2c4
! void goto_tabpage_tp __ARGS((tabpage_T *tp));
Karsten Hopp f5d2c4
  void goto_tabpage_win __ARGS((tabpage_T *tp, win_T *wp));
Karsten Hopp f5d2c4
  void tabpage_move __ARGS((int nr));
Karsten Hopp f5d2c4
  void win_goto __ARGS((win_T *wp));
Karsten Hopp f5d2c4
--- 27,33 ----
Karsten Hopp f5d2c4
  tabpage_T *find_tabpage __ARGS((int n));
Karsten Hopp f5d2c4
  int tabpage_index __ARGS((tabpage_T *ftp));
Karsten Hopp f5d2c4
  void goto_tabpage __ARGS((int n));
Karsten Hopp f5d2c4
! void goto_tabpage_tp __ARGS((tabpage_T *tp, int trigger_autocmds));
Karsten Hopp f5d2c4
  void goto_tabpage_win __ARGS((tabpage_T *tp, win_T *wp));
Karsten Hopp f5d2c4
  void tabpage_move __ARGS((int nr));
Karsten Hopp f5d2c4
  void win_goto __ARGS((win_T *wp));
Karsten Hopp f5d2c4
*** ../vim-7.3.550/src/window.c	2012-06-06 19:02:40.000000000 +0200
Karsten Hopp f5d2c4
--- src/window.c	2012-06-13 14:24:38.000000000 +0200
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 45,51 ****
Karsten Hopp f5d2c4
  #if defined(FEAT_WINDOWS) || defined(PROTO)
Karsten Hopp f5d2c4
  static tabpage_T *alloc_tabpage __ARGS((void));
Karsten Hopp f5d2c4
  static int leave_tabpage __ARGS((buf_T *new_curbuf));
Karsten Hopp f5d2c4
! static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf));
Karsten Hopp f5d2c4
  static void frame_fix_height __ARGS((win_T *wp));
Karsten Hopp f5d2c4
  static int frame_minheight __ARGS((frame_T *topfrp, win_T *next_curwin));
Karsten Hopp f5d2c4
  static void win_enter_ext __ARGS((win_T *wp, int undo_sync, int no_curwin));
Karsten Hopp f5d2c4
--- 45,51 ----
Karsten Hopp f5d2c4
  #if defined(FEAT_WINDOWS) || defined(PROTO)
Karsten Hopp f5d2c4
  static tabpage_T *alloc_tabpage __ARGS((void));
Karsten Hopp f5d2c4
  static int leave_tabpage __ARGS((buf_T *new_curbuf));
Karsten Hopp f5d2c4
! static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf, int trigger_autocmds));
Karsten Hopp f5d2c4
  static void frame_fix_height __ARGS((win_T *wp));
Karsten Hopp f5d2c4
  static int frame_minheight __ARGS((frame_T *topfrp, win_T *next_curwin));
Karsten Hopp f5d2c4
  static void win_enter_ext __ARGS((win_T *wp, int undo_sync, int no_curwin));
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 355,365 ****
Karsten Hopp f5d2c4
  						     && valid_tabpage(oldtab))
Karsten Hopp f5d2c4
  		    {
Karsten Hopp f5d2c4
  			newtab = curtab;
Karsten Hopp f5d2c4
! 			goto_tabpage_tp(oldtab);
Karsten Hopp f5d2c4
  			if (curwin == wp)
Karsten Hopp f5d2c4
  			    win_close(curwin, FALSE);
Karsten Hopp f5d2c4
  			if (valid_tabpage(newtab))
Karsten Hopp f5d2c4
! 			    goto_tabpage_tp(newtab);
Karsten Hopp f5d2c4
  		    }
Karsten Hopp f5d2c4
  		}
Karsten Hopp f5d2c4
  		break;
Karsten Hopp f5d2c4
--- 355,365 ----
Karsten Hopp f5d2c4
  						     && valid_tabpage(oldtab))
Karsten Hopp f5d2c4
  		    {
Karsten Hopp f5d2c4
  			newtab = curtab;
Karsten Hopp f5d2c4
! 			goto_tabpage_tp(oldtab, TRUE);
Karsten Hopp f5d2c4
  			if (curwin == wp)
Karsten Hopp f5d2c4
  			    win_close(curwin, FALSE);
Karsten Hopp f5d2c4
  			if (valid_tabpage(newtab))
Karsten Hopp f5d2c4
! 			    goto_tabpage_tp(newtab, TRUE);
Karsten Hopp f5d2c4
  		    }
Karsten Hopp f5d2c4
  		}
Karsten Hopp f5d2c4
  		break;
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 2130,2137 ****
Karsten Hopp f5d2c4
  	 * page and then close the window and the tab page.  This avoids that
Karsten Hopp f5d2c4
  	 * curwin and curtab are invalid while we are freeing memory, they may
Karsten Hopp f5d2c4
  	 * be used in GUI events.
Karsten Hopp f5d2c4
  	 */
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(alt_tabpage());
Karsten Hopp f5d2c4
  	redraw_tabline = TRUE;
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  	/* Safety check: Autocommands may have closed the window when jumping
Karsten Hopp f5d2c4
--- 2130,2139 ----
Karsten Hopp f5d2c4
  	 * page and then close the window and the tab page.  This avoids that
Karsten Hopp f5d2c4
  	 * curwin and curtab are invalid while we are freeing memory, they may
Karsten Hopp f5d2c4
  	 * be used in GUI events.
Karsten Hopp f5d2c4
+ 	 * Don't trigger autocommands yet, they may use wrong values, so do
Karsten Hopp f5d2c4
+ 	 * that below.
Karsten Hopp f5d2c4
  	 */
Karsten Hopp f5d2c4
! 	goto_tabpage_tp(alt_tabpage(), FALSE);
Karsten Hopp f5d2c4
  	redraw_tabline = TRUE;
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  	/* Safety check: Autocommands may have closed the window when jumping
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 2144,2149 ****
Karsten Hopp f5d2c4
--- 2146,2157 ----
Karsten Hopp f5d2c4
  	    if (h != tabline_height())
Karsten Hopp f5d2c4
  		shell_new_rows();
Karsten Hopp f5d2c4
  	}
Karsten Hopp f5d2c4
+ 	/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do
Karsten Hopp f5d2c4
+ 	 * that now. */
Karsten Hopp f5d2c4
+ #ifdef FEAT_AUTOCMD
Karsten Hopp f5d2c4
+ 	apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp f5d2c4
+ 	apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp f5d2c4
+ #endif
Karsten Hopp f5d2c4
  	return TRUE;
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
      return FALSE;
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 3556,3562 ****
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
      /* Failed, get back the previous Tab page */
Karsten Hopp f5d2c4
!     enter_tabpage(curtab, curbuf);
Karsten Hopp f5d2c4
      return FAIL;
Karsten Hopp f5d2c4
  }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
--- 3564,3570 ----
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
      /* Failed, get back the previous Tab page */
Karsten Hopp f5d2c4
!     enter_tabpage(curtab, curbuf, TRUE);
Karsten Hopp f5d2c4
      return FAIL;
Karsten Hopp f5d2c4
  }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 3709,3719 ****
Karsten Hopp f5d2c4
  /*
Karsten Hopp f5d2c4
   * Start using tab page "tp".
Karsten Hopp f5d2c4
   * Only to be used after leave_tabpage() or freeing the current tab page.
Karsten Hopp f5d2c4
   */
Karsten Hopp f5d2c4
      static void
Karsten Hopp f5d2c4
! enter_tabpage(tp, old_curbuf)
Karsten Hopp f5d2c4
      tabpage_T	*tp;
Karsten Hopp f5d2c4
      buf_T	*old_curbuf UNUSED;
Karsten Hopp f5d2c4
  {
Karsten Hopp f5d2c4
      int		old_off = tp->tp_firstwin->w_winrow;
Karsten Hopp f5d2c4
      win_T	*next_prevwin = tp->tp_prevwin;
Karsten Hopp f5d2c4
--- 3717,3729 ----
Karsten Hopp f5d2c4
  /*
Karsten Hopp f5d2c4
   * Start using tab page "tp".
Karsten Hopp f5d2c4
   * Only to be used after leave_tabpage() or freeing the current tab page.
Karsten Hopp f5d2c4
+  * Only trigger *Enter autocommands when trigger_autocmds is TRUE.
Karsten Hopp f5d2c4
   */
Karsten Hopp f5d2c4
      static void
Karsten Hopp f5d2c4
! enter_tabpage(tp, old_curbuf, trigger_autocmds)
Karsten Hopp f5d2c4
      tabpage_T	*tp;
Karsten Hopp f5d2c4
      buf_T	*old_curbuf UNUSED;
Karsten Hopp f5d2c4
+     int         trigger_autocmds;
Karsten Hopp f5d2c4
  {
Karsten Hopp f5d2c4
      int		old_off = tp->tp_firstwin->w_winrow;
Karsten Hopp f5d2c4
      win_T	*next_prevwin = tp->tp_prevwin;
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 3761,3769 ****
Karsten Hopp f5d2c4
  #ifdef FEAT_AUTOCMD
Karsten Hopp f5d2c4
      /* Apply autocommands after updating the display, when 'rows' and
Karsten Hopp f5d2c4
       * 'columns' have been set correctly. */
Karsten Hopp f5d2c4
!     apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp f5d2c4
!     if (old_curbuf != curbuf)
Karsten Hopp f5d2c4
! 	apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp f5d2c4
  #endif
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
      redraw_all_later(CLEAR);
Karsten Hopp f5d2c4
--- 3771,3782 ----
Karsten Hopp f5d2c4
  #ifdef FEAT_AUTOCMD
Karsten Hopp f5d2c4
      /* Apply autocommands after updating the display, when 'rows' and
Karsten Hopp f5d2c4
       * 'columns' have been set correctly. */
Karsten Hopp f5d2c4
!     if (trigger_autocmds)
Karsten Hopp f5d2c4
!     {
Karsten Hopp f5d2c4
! 	apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp f5d2c4
! 	if (old_curbuf != curbuf)
Karsten Hopp f5d2c4
! 	    apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
Karsten Hopp f5d2c4
!     }
Karsten Hopp f5d2c4
  #endif
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
      redraw_all_later(CLEAR);
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 3839,3845 ****
Karsten Hopp f5d2c4
  	}
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
!     goto_tabpage_tp(tp);
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  #ifdef FEAT_GUI_TABLINE
Karsten Hopp f5d2c4
      if (gui_use_tabline())
Karsten Hopp f5d2c4
--- 3852,3858 ----
Karsten Hopp f5d2c4
  	}
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
!     goto_tabpage_tp(tp, TRUE);
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  #ifdef FEAT_GUI_TABLINE
Karsten Hopp f5d2c4
      if (gui_use_tabline())
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 3849,3859 ****
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  /*
Karsten Hopp f5d2c4
   * Go to tabpage "tp".
Karsten Hopp f5d2c4
   * Note: doesn't update the GUI tab.
Karsten Hopp f5d2c4
   */
Karsten Hopp f5d2c4
      void
Karsten Hopp f5d2c4
! goto_tabpage_tp(tp)
Karsten Hopp f5d2c4
      tabpage_T	*tp;
Karsten Hopp f5d2c4
  {
Karsten Hopp f5d2c4
      /* Don't repeat a message in another tab page. */
Karsten Hopp f5d2c4
      set_keep_msg(NULL, 0);
Karsten Hopp f5d2c4
--- 3862,3874 ----
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
  /*
Karsten Hopp f5d2c4
   * Go to tabpage "tp".
Karsten Hopp f5d2c4
+  * Only trigger *Enter autocommands when trigger_autocmds is TRUE.
Karsten Hopp f5d2c4
   * Note: doesn't update the GUI tab.
Karsten Hopp f5d2c4
   */
Karsten Hopp f5d2c4
      void
Karsten Hopp f5d2c4
! goto_tabpage_tp(tp, trigger_autocmds)
Karsten Hopp f5d2c4
      tabpage_T	*tp;
Karsten Hopp f5d2c4
+     int         trigger_autocmds;
Karsten Hopp f5d2c4
  {
Karsten Hopp f5d2c4
      /* Don't repeat a message in another tab page. */
Karsten Hopp f5d2c4
      set_keep_msg(NULL, 0);
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 3861,3869 ****
Karsten Hopp f5d2c4
      if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer) == OK)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	if (valid_tabpage(tp))
Karsten Hopp f5d2c4
! 	    enter_tabpage(tp, curbuf);
Karsten Hopp f5d2c4
  	else
Karsten Hopp f5d2c4
! 	    enter_tabpage(curtab, curbuf);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
--- 3876,3884 ----
Karsten Hopp f5d2c4
      if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer) == OK)
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	if (valid_tabpage(tp))
Karsten Hopp f5d2c4
! 	    enter_tabpage(tp, curbuf, trigger_autocmds);
Karsten Hopp f5d2c4
  	else
Karsten Hopp f5d2c4
! 	    enter_tabpage(curtab, curbuf, trigger_autocmds);
Karsten Hopp f5d2c4
      }
Karsten Hopp f5d2c4
  }
Karsten Hopp f5d2c4
  
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 3876,3882 ****
Karsten Hopp f5d2c4
      tabpage_T	*tp;
Karsten Hopp f5d2c4
      win_T	*wp;
Karsten Hopp f5d2c4
  {
Karsten Hopp f5d2c4
!     goto_tabpage_tp(tp);
Karsten Hopp f5d2c4
      if (curtab == tp && win_valid(wp))
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	win_enter(wp, TRUE);
Karsten Hopp f5d2c4
--- 3891,3897 ----
Karsten Hopp f5d2c4
      tabpage_T	*tp;
Karsten Hopp f5d2c4
      win_T	*wp;
Karsten Hopp f5d2c4
  {
Karsten Hopp f5d2c4
!     goto_tabpage_tp(tp, TRUE);
Karsten Hopp f5d2c4
      if (curtab == tp && win_valid(wp))
Karsten Hopp f5d2c4
      {
Karsten Hopp f5d2c4
  	win_enter(wp, TRUE);
Karsten Hopp f5d2c4
*** ../vim-7.3.550/src/version.c	2012-06-13 14:01:36.000000000 +0200
Karsten Hopp f5d2c4
--- src/version.c	2012-06-13 14:28:00.000000000 +0200
Karsten Hopp f5d2c4
***************
Karsten Hopp f5d2c4
*** 716,717 ****
Karsten Hopp f5d2c4
--- 716,719 ----
Karsten Hopp f5d2c4
  {   /* Add new patch number below this line */
Karsten Hopp f5d2c4
+ /**/
Karsten Hopp f5d2c4
+     551,
Karsten Hopp f5d2c4
  /**/
Karsten Hopp f5d2c4
Karsten Hopp f5d2c4
-- 
Karsten Hopp f5d2c4
Give a man a computer program and you give him a headache,
Karsten Hopp f5d2c4
but teach him to program computers and you give him the power
Karsten Hopp f5d2c4
to create headaches for others for the rest of his life...
Karsten Hopp f5d2c4
        R. B. Forest
Karsten Hopp f5d2c4
Karsten Hopp f5d2c4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp f5d2c4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp f5d2c4
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp f5d2c4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///