Karsten Hopp a904b7
To: vim_dev@googlegroups.com
Karsten Hopp a904b7
Subject: Patch 7.3.1204
Karsten Hopp a904b7
Fcc: outbox
Karsten Hopp a904b7
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a904b7
Mime-Version: 1.0
Karsten Hopp a904b7
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a904b7
Content-Transfer-Encoding: 8bit
Karsten Hopp a904b7
------------
Karsten Hopp a904b7
Karsten Hopp a904b7
Patch 7.3.1204
Karsten Hopp a904b7
Problem:    Calling gettabwinvar() in 'tabline' cancels Visual mode. (Hirohito
Karsten Hopp a904b7
	    Higashi)
Karsten Hopp a904b7
Solution:   Don't always use goto_tabpage_tp().
Karsten Hopp a904b7
Files:	    src/window.c, src/proto/window.pro, src/eval.c, src/if_py_both.h
Karsten Hopp a904b7
Karsten Hopp a904b7
Karsten Hopp a904b7
*** ../vim-7.3.1203/src/window.c	2013-06-08 18:19:40.000000000 +0200
Karsten Hopp a904b7
--- src/window.c	2013-06-16 14:08:52.000000000 +0200
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 3774,3780 ****
Karsten Hopp a904b7
      /* We would like doing the TabEnter event first, but we don't have a
Karsten Hopp a904b7
       * valid current window yet, which may break some commands.
Karsten Hopp a904b7
       * This triggers autocommands, thus may make "tp" invalid. */
Karsten Hopp a904b7
!     win_enter_ext(tp->tp_curwin, FALSE, TRUE, trigger_enter_autocmds, trigger_leave_autocmds);
Karsten Hopp a904b7
      prevwin = next_prevwin;
Karsten Hopp a904b7
  
Karsten Hopp a904b7
      last_status(FALSE);		/* status line may appear or disappear */
Karsten Hopp a904b7
--- 3774,3781 ----
Karsten Hopp a904b7
      /* We would like doing the TabEnter event first, but we don't have a
Karsten Hopp a904b7
       * valid current window yet, which may break some commands.
Karsten Hopp a904b7
       * This triggers autocommands, thus may make "tp" invalid. */
Karsten Hopp a904b7
!     win_enter_ext(tp->tp_curwin, FALSE, TRUE,
Karsten Hopp a904b7
! 			      trigger_enter_autocmds, trigger_leave_autocmds);
Karsten Hopp a904b7
      prevwin = next_prevwin;
Karsten Hopp a904b7
  
Karsten Hopp a904b7
      last_status(FALSE);		/* status line may appear or disappear */
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 6575,6588 ****
Karsten Hopp a904b7
   * Set "win" to be the curwin and "tp" to be the current tab page.
Karsten Hopp a904b7
   * restore_win() MUST be called to undo.
Karsten Hopp a904b7
   * No autocommands will be executed.
Karsten Hopp a904b7
   * Returns FAIL if switching to "win" failed.
Karsten Hopp a904b7
   */
Karsten Hopp a904b7
      int
Karsten Hopp a904b7
! switch_win(save_curwin, save_curtab, win, tp)
Karsten Hopp a904b7
      win_T	**save_curwin;
Karsten Hopp a904b7
      tabpage_T	**save_curtab;
Karsten Hopp a904b7
      win_T	*win;
Karsten Hopp a904b7
      tabpage_T	*tp;
Karsten Hopp a904b7
  {
Karsten Hopp a904b7
  # ifdef FEAT_AUTOCMD
Karsten Hopp a904b7
      block_autocmds();
Karsten Hopp a904b7
--- 6576,6592 ----
Karsten Hopp a904b7
   * Set "win" to be the curwin and "tp" to be the current tab page.
Karsten Hopp a904b7
   * restore_win() MUST be called to undo.
Karsten Hopp a904b7
   * No autocommands will be executed.
Karsten Hopp a904b7
+  * When "no_display" is TRUE the display won't be affected, no redraw is
Karsten Hopp a904b7
+  * triggered, another tabpage access is limited.
Karsten Hopp a904b7
   * Returns FAIL if switching to "win" failed.
Karsten Hopp a904b7
   */
Karsten Hopp a904b7
      int
Karsten Hopp a904b7
! switch_win(save_curwin, save_curtab, win, tp, no_display)
Karsten Hopp a904b7
      win_T	**save_curwin;
Karsten Hopp a904b7
      tabpage_T	**save_curtab;
Karsten Hopp a904b7
      win_T	*win;
Karsten Hopp a904b7
      tabpage_T	*tp;
Karsten Hopp a904b7
+     int		no_display;
Karsten Hopp a904b7
  {
Karsten Hopp a904b7
  # ifdef FEAT_AUTOCMD
Karsten Hopp a904b7
      block_autocmds();
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 6592,6598 ****
Karsten Hopp a904b7
      if (tp != NULL)
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  	*save_curtab = curtab;
Karsten Hopp a904b7
! 	goto_tabpage_tp(tp, FALSE, FALSE);
Karsten Hopp a904b7
      }
Karsten Hopp a904b7
      if (!win_valid(win))
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
--- 6596,6611 ----
Karsten Hopp a904b7
      if (tp != NULL)
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  	*save_curtab = curtab;
Karsten Hopp a904b7
! 	if (no_display)
Karsten Hopp a904b7
! 	{
Karsten Hopp a904b7
! 	    curtab->tp_firstwin = firstwin;
Karsten Hopp a904b7
! 	    curtab->tp_lastwin = lastwin;
Karsten Hopp a904b7
! 	    curtab = tp;
Karsten Hopp a904b7
! 	    firstwin = curtab->tp_firstwin;
Karsten Hopp a904b7
! 	    lastwin = curtab->tp_lastwin;
Karsten Hopp a904b7
! 	}
Karsten Hopp a904b7
! 	else
Karsten Hopp a904b7
! 	    goto_tabpage_tp(tp, FALSE, FALSE);
Karsten Hopp a904b7
      }
Karsten Hopp a904b7
      if (!win_valid(win))
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 6609,6623 ****
Karsten Hopp a904b7
  
Karsten Hopp a904b7
  /*
Karsten Hopp a904b7
   * Restore current tabpage and window saved by switch_win(), if still valid.
Karsten Hopp a904b7
   */
Karsten Hopp a904b7
      void
Karsten Hopp a904b7
! restore_win(save_curwin, save_curtab)
Karsten Hopp a904b7
      win_T	*save_curwin;
Karsten Hopp a904b7
      tabpage_T	*save_curtab;
Karsten Hopp a904b7
  {
Karsten Hopp a904b7
  # ifdef FEAT_WINDOWS
Karsten Hopp a904b7
      if (save_curtab != NULL && valid_tabpage(save_curtab))
Karsten Hopp a904b7
! 	goto_tabpage_tp(save_curtab, FALSE, FALSE);
Karsten Hopp a904b7
      if (win_valid(save_curwin))
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  	curwin = save_curwin;
Karsten Hopp a904b7
--- 6622,6650 ----
Karsten Hopp a904b7
  
Karsten Hopp a904b7
  /*
Karsten Hopp a904b7
   * Restore current tabpage and window saved by switch_win(), if still valid.
Karsten Hopp a904b7
+  * When "no_display" is TRUE the display won't be affected, no redraw is
Karsten Hopp a904b7
+  * triggered.
Karsten Hopp a904b7
   */
Karsten Hopp a904b7
      void
Karsten Hopp a904b7
! restore_win(save_curwin, save_curtab, no_display)
Karsten Hopp a904b7
      win_T	*save_curwin;
Karsten Hopp a904b7
      tabpage_T	*save_curtab;
Karsten Hopp a904b7
+     int		no_display;
Karsten Hopp a904b7
  {
Karsten Hopp a904b7
  # ifdef FEAT_WINDOWS
Karsten Hopp a904b7
      if (save_curtab != NULL && valid_tabpage(save_curtab))
Karsten Hopp a904b7
!     {
Karsten Hopp a904b7
! 	if (no_display)
Karsten Hopp a904b7
! 	{
Karsten Hopp a904b7
! 	    curtab->tp_firstwin = firstwin;
Karsten Hopp a904b7
! 	    curtab->tp_lastwin = lastwin;
Karsten Hopp a904b7
! 	    curtab = save_curtab;
Karsten Hopp a904b7
! 	    firstwin = curtab->tp_firstwin;
Karsten Hopp a904b7
! 	    lastwin = curtab->tp_lastwin;
Karsten Hopp a904b7
! 	}
Karsten Hopp a904b7
! 	else
Karsten Hopp a904b7
! 	    goto_tabpage_tp(save_curtab, FALSE, FALSE);
Karsten Hopp a904b7
!     }
Karsten Hopp a904b7
      if (win_valid(save_curwin))
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  	curwin = save_curwin;
Karsten Hopp a904b7
*** ../vim-7.3.1203/src/proto/window.pro	2013-05-17 16:03:53.000000000 +0200
Karsten Hopp a904b7
--- src/proto/window.pro	2013-06-16 13:48:18.000000000 +0200
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 70,77 ****
Karsten Hopp a904b7
  void check_lnums __ARGS((int do_curwin));
Karsten Hopp a904b7
  void make_snapshot __ARGS((int idx));
Karsten Hopp a904b7
  void restore_snapshot __ARGS((int idx, int close_curwin));
Karsten Hopp a904b7
! int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp));
Karsten Hopp a904b7
! void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab));
Karsten Hopp a904b7
  void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
Karsten Hopp a904b7
  void restore_buffer __ARGS((buf_T *save_curbuf));
Karsten Hopp a904b7
  int win_hasvertsplit __ARGS((void));
Karsten Hopp a904b7
--- 70,77 ----
Karsten Hopp a904b7
  void check_lnums __ARGS((int do_curwin));
Karsten Hopp a904b7
  void make_snapshot __ARGS((int idx));
Karsten Hopp a904b7
  void restore_snapshot __ARGS((int idx, int close_curwin));
Karsten Hopp a904b7
! int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display));
Karsten Hopp a904b7
! void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab, int no_display));
Karsten Hopp a904b7
  void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
Karsten Hopp a904b7
  void restore_buffer __ARGS((buf_T *save_curbuf));
Karsten Hopp a904b7
  int win_hasvertsplit __ARGS((void));
Karsten Hopp a904b7
*** ../vim-7.3.1203/src/eval.c	2013-06-13 21:24:01.000000000 +0200
Karsten Hopp a904b7
--- src/eval.c	2013-06-16 14:03:15.000000000 +0200
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 11952,11958 ****
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  	/* Set curwin to be our win, temporarily.  Also set the tabpage,
Karsten Hopp a904b7
  	 * otherwise the window is not valid. */
Karsten Hopp a904b7
! 	switch_win(&oldcurwin, &oldtabpage, win, tp);
Karsten Hopp a904b7
  
Karsten Hopp a904b7
  	if (*varname == '&')	/* window-local-option */
Karsten Hopp a904b7
  	{
Karsten Hopp a904b7
--- 11952,11958 ----
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  	/* Set curwin to be our win, temporarily.  Also set the tabpage,
Karsten Hopp a904b7
  	 * otherwise the window is not valid. */
Karsten Hopp a904b7
! 	switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE);
Karsten Hopp a904b7
  
Karsten Hopp a904b7
  	if (*varname == '&')	/* window-local-option */
Karsten Hopp a904b7
  	{
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 11972,11978 ****
Karsten Hopp a904b7
  	}
Karsten Hopp a904b7
  
Karsten Hopp a904b7
  	/* restore previous notion of curwin */
Karsten Hopp a904b7
! 	restore_win(oldcurwin, oldtabpage);
Karsten Hopp a904b7
      }
Karsten Hopp a904b7
  
Karsten Hopp a904b7
      if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
Karsten Hopp a904b7
--- 11972,11978 ----
Karsten Hopp a904b7
  	}
Karsten Hopp a904b7
  
Karsten Hopp a904b7
  	/* restore previous notion of curwin */
Karsten Hopp a904b7
! 	restore_win(oldcurwin, oldtabpage, TRUE);
Karsten Hopp a904b7
      }
Karsten Hopp a904b7
  
Karsten Hopp a904b7
      if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 16775,16781 ****
Karsten Hopp a904b7
      if (win != NULL && varname != NULL && varp != NULL)
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  #ifdef FEAT_WINDOWS
Karsten Hopp a904b7
! 	if (switch_win(&save_curwin, &save_curtab, win, tp) == FAIL)
Karsten Hopp a904b7
  	    return;
Karsten Hopp a904b7
  #endif
Karsten Hopp a904b7
  
Karsten Hopp a904b7
--- 16775,16781 ----
Karsten Hopp a904b7
      if (win != NULL && varname != NULL && varp != NULL)
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  #ifdef FEAT_WINDOWS
Karsten Hopp a904b7
! 	if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == FAIL)
Karsten Hopp a904b7
  	    return;
Karsten Hopp a904b7
  #endif
Karsten Hopp a904b7
  
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 16804,16810 ****
Karsten Hopp a904b7
  	}
Karsten Hopp a904b7
  
Karsten Hopp a904b7
  #ifdef FEAT_WINDOWS
Karsten Hopp a904b7
! 	restore_win(save_curwin, save_curtab);
Karsten Hopp a904b7
  #endif
Karsten Hopp a904b7
      }
Karsten Hopp a904b7
  }
Karsten Hopp a904b7
--- 16804,16810 ----
Karsten Hopp a904b7
  	}
Karsten Hopp a904b7
  
Karsten Hopp a904b7
  #ifdef FEAT_WINDOWS
Karsten Hopp a904b7
! 	restore_win(save_curwin, save_curtab, TRUE);
Karsten Hopp a904b7
  #endif
Karsten Hopp a904b7
      }
Karsten Hopp a904b7
  }
Karsten Hopp a904b7
*** ../vim-7.3.1203/src/if_py_both.h	2013-06-12 18:13:31.000000000 +0200
Karsten Hopp a904b7
--- src/if_py_both.h	2013-06-16 13:54:21.000000000 +0200
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 2706,2712 ****
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  	case SREQ_WIN:
Karsten Hopp a904b7
  	    if (switch_win(&save_curwin, &save_curtab, (win_T *)from,
Karsten Hopp a904b7
! 				     win_find_tabpage((win_T *)from)) == FAIL)
Karsten Hopp a904b7
  	    {
Karsten Hopp a904b7
  		if (VimTryEnd())
Karsten Hopp a904b7
  		    return -1;
Karsten Hopp a904b7
--- 2702,2708 ----
Karsten Hopp a904b7
      {
Karsten Hopp a904b7
  	case SREQ_WIN:
Karsten Hopp a904b7
  	    if (switch_win(&save_curwin, &save_curtab, (win_T *)from,
Karsten Hopp a904b7
! 			      win_find_tabpage((win_T *)from), FALSE) == FAIL)
Karsten Hopp a904b7
  	    {
Karsten Hopp a904b7
  		if (VimTryEnd())
Karsten Hopp a904b7
  		    return -1;
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 2714,2720 ****
Karsten Hopp a904b7
  		return -1;
Karsten Hopp a904b7
  	    }
Karsten Hopp a904b7
  	    r = set_option_value_err(key, numval, stringval, opt_flags);
Karsten Hopp a904b7
! 	    restore_win(save_curwin, save_curtab);
Karsten Hopp a904b7
  	    if (r == FAIL)
Karsten Hopp a904b7
  		return -1;
Karsten Hopp a904b7
  	    break;
Karsten Hopp a904b7
--- 2710,2716 ----
Karsten Hopp a904b7
  		return -1;
Karsten Hopp a904b7
  	    }
Karsten Hopp a904b7
  	    r = set_option_value_err(key, numval, stringval, opt_flags);
Karsten Hopp a904b7
! 	    restore_win(save_curwin, save_curtab, FALSE);
Karsten Hopp a904b7
  	    if (r == FAIL)
Karsten Hopp a904b7
  		return -1;
Karsten Hopp a904b7
  	    break;
Karsten Hopp a904b7
*** ../vim-7.3.1203/src/version.c	2013-06-15 23:00:26.000000000 +0200
Karsten Hopp a904b7
--- src/version.c	2013-06-16 13:44:37.000000000 +0200
Karsten Hopp a904b7
***************
Karsten Hopp a904b7
*** 730,731 ****
Karsten Hopp a904b7
--- 730,733 ----
Karsten Hopp a904b7
  {   /* Add new patch number below this line */
Karsten Hopp a904b7
+ /**/
Karsten Hopp a904b7
+     1204,
Karsten Hopp a904b7
  /**/
Karsten Hopp a904b7
Karsten Hopp a904b7
-- 
Karsten Hopp a904b7
hundred-and-one symptoms of being an internet addict:
Karsten Hopp a904b7
224. You set up your own Web page. You set up a Web page for each
Karsten Hopp a904b7
     of your kids... and your pets.
Karsten Hopp a904b7
Karsten Hopp a904b7
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a904b7
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a904b7
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a904b7
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///