Karsten Hopp 5e9e27
To: vim_dev@googlegroups.com
Karsten Hopp 5e9e27
Subject: Patch 7.4.434
Karsten Hopp 5e9e27
Fcc: outbox
Karsten Hopp 5e9e27
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 5e9e27
Mime-Version: 1.0
Karsten Hopp 5e9e27
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 5e9e27
Content-Transfer-Encoding: 8bit
Karsten Hopp 5e9e27
------------
Karsten Hopp 5e9e27
Karsten Hopp 5e9e27
Patch 7.4.434
Karsten Hopp 5e9e27
Problem:    gettabvar() is not consistent with getwinvar() and getbufvar().
Karsten Hopp 5e9e27
Solution:   Return a dict with all variables when the varname is empty.
Karsten Hopp 5e9e27
	    (Yasuhiro Matsumoto)
Karsten Hopp 5e9e27
Files:	    src/eval.c, runtime/doc/eval.txt, src/testdir/test91.in,
Karsten Hopp 5e9e27
	    src/testdir/test91.ok
Karsten Hopp 5e9e27
Karsten Hopp 5e9e27
Karsten Hopp 5e9e27
*** ../vim-7.4.433/src/eval.c	2014-08-29 15:53:43.706453155 +0200
Karsten Hopp 5e9e27
--- src/eval.c	2014-09-09 16:03:34.372530448 +0200
Karsten Hopp 5e9e27
***************
Karsten Hopp 5e9e27
*** 12071,12077 ****
Karsten Hopp 5e9e27
      typval_T	*argvars;
Karsten Hopp 5e9e27
      typval_T	*rettv;
Karsten Hopp 5e9e27
  {
Karsten Hopp 5e9e27
!     tabpage_T	*tp;
Karsten Hopp 5e9e27
      dictitem_T	*v;
Karsten Hopp 5e9e27
      char_u	*varname;
Karsten Hopp 5e9e27
      int		done = FALSE;
Karsten Hopp 5e9e27
--- 12071,12078 ----
Karsten Hopp 5e9e27
      typval_T	*argvars;
Karsten Hopp 5e9e27
      typval_T	*rettv;
Karsten Hopp 5e9e27
  {
Karsten Hopp 5e9e27
!     win_T	*win, *oldcurwin;
Karsten Hopp 5e9e27
!     tabpage_T	*tp, *oldtabpage;
Karsten Hopp 5e9e27
      dictitem_T	*v;
Karsten Hopp 5e9e27
      char_u	*varname;
Karsten Hopp 5e9e27
      int		done = FALSE;
Karsten Hopp 5e9e27
***************
Karsten Hopp 5e9e27
*** 12083,12095 ****
Karsten Hopp 5e9e27
      tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
Karsten Hopp 5e9e27
      if (tp != NULL && varname != NULL)
Karsten Hopp 5e9e27
      {
Karsten Hopp 5e9e27
  	/* look up the variable */
Karsten Hopp 5e9e27
! 	v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE);
Karsten Hopp 5e9e27
  	if (v != NULL)
Karsten Hopp 5e9e27
  	{
Karsten Hopp 5e9e27
  	    copy_tv(&v->di_tv, rettv);
Karsten Hopp 5e9e27
  	    done = TRUE;
Karsten Hopp 5e9e27
  	}
Karsten Hopp 5e9e27
      }
Karsten Hopp 5e9e27
  
Karsten Hopp 5e9e27
      if (!done && argvars[2].v_type != VAR_UNKNOWN)
Karsten Hopp 5e9e27
--- 12084,12104 ----
Karsten Hopp 5e9e27
      tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
Karsten Hopp 5e9e27
      if (tp != NULL && varname != NULL)
Karsten Hopp 5e9e27
      {
Karsten Hopp 5e9e27
+ 	/* Set curwin to be our win, temporarily.  Also set the tabpage,
Karsten Hopp 5e9e27
+ 	 * otherwise the window is not valid. */
Karsten Hopp 5e9e27
+ 	switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE);
Karsten Hopp 5e9e27
+ 
Karsten Hopp 5e9e27
  	/* look up the variable */
Karsten Hopp 5e9e27
! 	/* Let gettabvar({nr}, "") return the "t:" dictionary. */
Karsten Hopp 5e9e27
! 	v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE);
Karsten Hopp 5e9e27
  	if (v != NULL)
Karsten Hopp 5e9e27
  	{
Karsten Hopp 5e9e27
  	    copy_tv(&v->di_tv, rettv);
Karsten Hopp 5e9e27
  	    done = TRUE;
Karsten Hopp 5e9e27
  	}
Karsten Hopp 5e9e27
+ 
Karsten Hopp 5e9e27
+ 	/* restore previous notion of curwin */
Karsten Hopp 5e9e27
+ 	restore_win(oldcurwin, oldtabpage, TRUE);
Karsten Hopp 5e9e27
      }
Karsten Hopp 5e9e27
  
Karsten Hopp 5e9e27
      if (!done && argvars[2].v_type != VAR_UNKNOWN)
Karsten Hopp 5e9e27
*** ../vim-7.4.433/runtime/doc/eval.txt	2014-08-29 15:53:43.714453155 +0200
Karsten Hopp 5e9e27
--- runtime/doc/eval.txt	2014-09-09 16:00:31.776530049 +0200
Karsten Hopp 5e9e27
***************
Karsten Hopp 5e9e27
*** 3535,3540 ****
Karsten Hopp 5e9e27
--- 3576,3583 ----
Karsten Hopp 5e9e27
  		Get the value of a tab-local variable {varname} in tab page
Karsten Hopp 5e9e27
  		{tabnr}. |t:var|
Karsten Hopp 5e9e27
  		Tabs are numbered starting with one.
Karsten Hopp 5e9e27
+ 		When {varname} is empty a dictionary with all tab-local
Karsten Hopp 5e9e27
+ 		variables is returned.
Karsten Hopp 5e9e27
  		Note that the name without "t:" must be used.
Karsten Hopp 5e9e27
  		When the tab or variable doesn't exist {def} or an empty
Karsten Hopp 5e9e27
  		string is returned, there is no error message.
Karsten Hopp 5e9e27
*** ../vim-7.4.433/src/testdir/test91.in	2013-07-24 14:53:47.000000000 +0200
Karsten Hopp 5e9e27
--- src/testdir/test91.in	2014-09-09 16:08:40.116531116 +0200
Karsten Hopp 5e9e27
***************
Karsten Hopp 5e9e27
*** 55,60 ****
Karsten Hopp 5e9e27
--- 55,61 ----
Karsten Hopp 5e9e27
  :tabnew
Karsten Hopp 5e9e27
  :tabnew
Karsten Hopp 5e9e27
  :let t:var_list = [1, 2, 3]
Karsten Hopp 5e9e27
+ :let t:other = 777
Karsten Hopp 5e9e27
  :let def_list = [4, 5, 6, 7]
Karsten Hopp 5e9e27
  :tabrewind
Karsten Hopp 5e9e27
  :$put =string(gettabvar(3, 'var_list'))
Karsten Hopp 5e9e27
*** ../vim-7.4.433/src/testdir/test91.ok	2013-07-24 14:52:47.000000000 +0200
Karsten Hopp 5e9e27
--- src/testdir/test91.ok	2014-09-09 16:09:27.624531220 +0200
Karsten Hopp 5e9e27
***************
Karsten Hopp 5e9e27
*** 26,33 ****
Karsten Hopp 5e9e27
  0
Karsten Hopp 5e9e27
  [1, 2, 3]
Karsten Hopp 5e9e27
  [1, 2, 3]
Karsten Hopp 5e9e27
! ''
Karsten Hopp 5e9e27
! [4, 5, 6, 7]
Karsten Hopp 5e9e27
  [4, 5, 6, 7]
Karsten Hopp 5e9e27
  ''
Karsten Hopp 5e9e27
  [4, 5, 6, 7]
Karsten Hopp 5e9e27
--- 26,33 ----
Karsten Hopp 5e9e27
  0
Karsten Hopp 5e9e27
  [1, 2, 3]
Karsten Hopp 5e9e27
  [1, 2, 3]
Karsten Hopp 5e9e27
! {'var_list': [1, 2, 3], 'other': 777}
Karsten Hopp 5e9e27
! {'var_list': [1, 2, 3], 'other': 777}
Karsten Hopp 5e9e27
  [4, 5, 6, 7]
Karsten Hopp 5e9e27
  ''
Karsten Hopp 5e9e27
  [4, 5, 6, 7]
Karsten Hopp 5e9e27
*** ../vim-7.4.433/src/version.c	2014-09-09 13:52:55.028513324 +0200
Karsten Hopp 5e9e27
--- src/version.c	2014-09-09 16:09:17.824531199 +0200
Karsten Hopp 5e9e27
***************
Karsten Hopp 5e9e27
*** 743,744 ****
Karsten Hopp 5e9e27
--- 743,746 ----
Karsten Hopp 5e9e27
  {   /* Add new patch number below this line */
Karsten Hopp 5e9e27
+ /**/
Karsten Hopp 5e9e27
+     434,
Karsten Hopp 5e9e27
  /**/
Karsten Hopp 5e9e27
Karsten Hopp 5e9e27
-- 
Karsten Hopp 5e9e27
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 5e9e27
108. While reading a magazine, you look for the Zoom icon for a better
Karsten Hopp 5e9e27
     look at a photograph.
Karsten Hopp 5e9e27
Karsten Hopp 5e9e27
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 5e9e27
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 5e9e27
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 5e9e27
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///