From 059986e03827c24e2fa1ac2a3b66743dfed9a8d9 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 14 Jul 2018 11:20:59 -0400 Subject: vim-patch:8.0.1160: getting tab-local variable fails after closing window Problem: Getting tab-local variable fails after closing window. Solution: set tp_firstwin and tp_lastwin. (Jason Franklin, closes vim/vim#2170) https://github.com/vim/vim/commit/816968defc8ae79eb7e2319e991e74661be8d750 --- src/nvim/eval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 3abc39e7bf..b495e591d2 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10222,7 +10222,8 @@ static void f_gettabvar(typval_T *argvars, typval_T *rettv, FunPtr fptr) 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. - win_T *window = tp->tp_firstwin == NULL ? firstwin : tp->tp_firstwin; + win_T *window = tp == curtab || tp->tp_firstwin == NULL ? firstwin + : tp->tp_firstwin; if (switch_win(&oldcurwin, &oldtabpage, window, tp, true) == OK) { // look up the variable // Let gettabvar({nr}, "") return the "t:" dictionary. -- cgit From c23327773724bd66942e541113b9053481b949e7 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 1 Aug 2018 12:29:42 -0400 Subject: eval: add const to f_gettabvar() variables --- src/nvim/eval.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b495e591d2..c51ffbdc3c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10210,25 +10210,26 @@ static void f_gettabinfo(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_gettabvar(typval_T *argvars, typval_T *rettv, FunPtr fptr) { win_T *oldcurwin; - tabpage_T *tp, *oldtabpage; - dictitem_T *v; + tabpage_T *oldtabpage; bool done = false; rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; const char *const varname = tv_get_string_chk(&argvars[1]); - tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); + tabpage_T *const tp = find_tabpage((int)tv_get_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. - win_T *window = tp == curtab || tp->tp_firstwin == NULL ? firstwin - : tp->tp_firstwin; + win_T *const window = tp == curtab || tp->tp_firstwin == NULL + ? firstwin + : tp->tp_firstwin; if (switch_win(&oldcurwin, &oldtabpage, window, tp, true) == OK) { // look up the variable // Let gettabvar({nr}, "") return the "t:" dictionary. - v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', - varname, strlen(varname), false); + const dictitem_T *const v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', + varname, strlen(varname), + false); if (v != NULL) { tv_copy(&v->di_tv, rettv); done = true; -- cgit From 2b229b816bcdbdd861a23fcdb80da1c97ff8d075 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 7 Aug 2018 11:40:52 -0400 Subject: window: no_display in restore_win() is bool --- src/nvim/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index c51ffbdc3c..b86c4efc95 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10236,8 +10236,8 @@ static void f_gettabvar(typval_T *argvars, typval_T *rettv, FunPtr fptr) } } - /* restore previous notion of curwin */ - restore_win(oldcurwin, oldtabpage, TRUE); + // restore previous notion of curwin + restore_win(oldcurwin, oldtabpage, true); } if (!done && argvars[2].v_type != VAR_UNKNOWN) { -- cgit