]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.434 v7.4.434
authorBram Moolenaar <Bram@vim.org>
Tue, 9 Sep 2014 14:13:08 +0000 (16:13 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 9 Sep 2014 14:13:08 +0000 (16:13 +0200)
Problem:    gettabvar() is not consistent with getwinvar() and getbufvar().
Solution:   Return a dict with all variables when the varname is empty.
            (Yasuhiro Matsumoto)

runtime/doc/eval.txt
src/eval.c
src/testdir/test91.in
src/testdir/test91.ok
src/version.c

index 688fc38eb8a379aefe9a48183d49c0b3a333a09b..e5aa09c8a5a9e52eadd7a2de19fa38b0faddc111 100644 (file)
@@ -3575,6 +3575,8 @@ gettabvar({tabnr}, {varname} [, {def}])                           *gettabvar()*
                Get the value of a tab-local variable {varname} in tab page
                {tabnr}. |t:var|
                Tabs are numbered starting with one.
+               When {varname} is empty a dictionary with all tab-local
+               variables is returned.
                Note that the name without "t:" must be used.
                When the tab or variable doesn't exist {def} or an empty
                string is returned, there is no error message.
index 7bf52c5f30c68dd673b8e05da7e38ce0d5c63569..8303bd3759630e7aa004908c05cb22771d1b60fa 100644 (file)
@@ -12071,7 +12071,8 @@ f_gettabvar(argvars, rettv)
     typval_T   *argvars;
     typval_T   *rettv;
 {
-    tabpage_T  *tp;
+    win_T      *win, *oldcurwin;
+    tabpage_T  *tp, *oldtabpage;
     dictitem_T *v;
     char_u     *varname;
     int                done = FALSE;
@@ -12083,13 +12084,21 @@ f_gettabvar(argvars, rettv)
     tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
     if (tp != NULL && varname != NULL)
     {
+       /* Set curwin to be our win, temporarily.  Also set the tabpage,
+        * otherwise the window is not valid. */
+       switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE);
+
        /* look up the variable */
-       v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE);
+       /* Let gettabvar({nr}, "") return the "t:" dictionary. */
+       v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE);
        if (v != NULL)
        {
            copy_tv(&v->di_tv, rettv);
            done = TRUE;
        }
+
+       /* restore previous notion of curwin */
+       restore_win(oldcurwin, oldtabpage, TRUE);
     }
 
     if (!done && argvars[2].v_type != VAR_UNKNOWN)
index e900a522dfa9f7e51d31a08b6159bb1ce0926ed8..b66776b1e45fcd6dd3175a456f1b47cb5d849f18 100644 (file)
@@ -55,6 +55,7 @@ STARTTEST
 :tabnew
 :tabnew
 :let t:var_list = [1, 2, 3]
+:let t:other = 777
 :let def_list = [4, 5, 6, 7]
 :tabrewind
 :$put =string(gettabvar(3, 'var_list'))
index 22e1572209101b439d1b753b845b7f73e7631367..809952b69d9d983073a94effe76e93c404887513 100644 (file)
@@ -26,8 +26,8 @@ iso-8859-2
 0
 [1, 2, 3]
 [1, 2, 3]
-''
-[4, 5, 6, 7]
+{'var_list': [1, 2, 3], 'other': 777}
+{'var_list': [1, 2, 3], 'other': 777}
 [4, 5, 6, 7]
 ''
 [4, 5, 6, 7]
index 4d9fb1ee315ef57b376de477a5f9b0138a6e8f41..1e68b49e9f9b1aca8bfc7affe6887a9a5dffb048 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    434,
 /**/
     433,
 /**/