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 #2170)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 7b019a5..55d2295 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -5183,8 +5183,8 @@
/* Set tp to be our tabpage, temporarily. Also set the window to the
* first window in the tabpage, otherwise the window is not valid. */
if (switch_win(&oldcurwin, &oldtabpage,
- tp->tp_firstwin == NULL ? firstwin : tp->tp_firstwin, tp, TRUE)
- == OK)
+ tp == curtab || tp->tp_firstwin == NULL ? firstwin
+ : tp->tp_firstwin, tp, TRUE) == OK)
{
/* look up the variable */
/* Let gettabvar({nr}, "") return the "t:" dictionary. */