aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c16
-rw-r--r--src/nvim/testdir/test91.in1
-rw-r--r--src/nvim/testdir/test91.ok4
-rw-r--r--src/nvim/version.c4
4 files changed, 18 insertions, 7 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 71cb83e566..c79a467889 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -9603,7 +9603,8 @@ static void f_getregtype(typval_T *argvars, typval_T *rettv)
*/
static void f_gettabvar(typval_T *argvars, typval_T *rettv)
{
- tabpage_T *tp;
+ win_T *oldcurwin;
+ tabpage_T *tp, *oldtabpage;
dictitem_T *v;
char_u *varname;
int done = FALSE;
@@ -9614,16 +9615,25 @@ static void f_gettabvar(typval_T *argvars, typval_T *rettv)
varname = get_tv_string_chk(&argvars[1]);
tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
if (tp != NULL && varname != NULL) {
+ /* Set tp to be our tabpage, temporarily. Also set the window to the
+ * first window in the tabpage, otherwise the window is not valid. */
+ switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, 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)
+ if (!done && argvars[2].v_type != VAR_UNKNOWN) {
copy_tv(&argvars[2], rettv);
+ }
}
/*
diff --git a/src/nvim/testdir/test91.in b/src/nvim/testdir/test91.in
index e900a522df..b66776b1e4 100644
--- a/src/nvim/testdir/test91.in
+++ b/src/nvim/testdir/test91.in
@@ -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'))
diff --git a/src/nvim/testdir/test91.ok b/src/nvim/testdir/test91.ok
index 22e1572209..809952b69d 100644
--- a/src/nvim/testdir/test91.ok
+++ b/src/nvim/testdir/test91.ok
@@ -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]
diff --git a/src/nvim/version.c b/src/nvim/version.c
index de4f6ffd87..5ac070bce5 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -287,7 +287,7 @@ static int included_patches[] = {
//445,
444,
//443,
- //442,
+ 442,
//441,
440,
439,
@@ -295,7 +295,7 @@ static int included_patches[] = {
437,
436,
435,
- //434,
+ 434,
433,
//432 NA
//431 NA