1
0
forked from aniani/vim

updated for version 7.4.434

Problem:    gettabvar() is not consistent with getwinvar() and getbufvar().
Solution:   Return a dict with all variables when the varname is empty.
            (Yasuhiro Matsumoto)
This commit is contained in:
Bram Moolenaar
2014-09-09 16:13:08 +02:00
parent 13e2a0af66
commit 0e2ea1beb4
5 changed files with 18 additions and 4 deletions

View 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)