diff src/testdir/test_getvar.vim @ 12564:183dc24cf861 v8.0.1160

patch 8.0.1160: getting tab-local variable fails after closing window commit https://github.com/vim/vim/commit/816968defc8ae79eb7e2319e991e74661be8d750 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 29 21:29:18 2017 +0200 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 https://github.com/vim/vim/issues/2170)
author Christian Brabandt <cb@256bit.org>
date Fri, 29 Sep 2017 21:30:05 +0200
parents 7d7835ab8b37
children 2b4c138bf8e9
line wrap: on
line diff
--- a/src/testdir/test_getvar.vim
+++ b/src/testdir/test_getvar.vim
@@ -86,3 +86,19 @@ func Test_var()
   call assert_equal(1, gettabwinvar(2, 3, '&nux', 1))
   tabonly
 endfunc
+
+" It was discovered that "gettabvar()" would fail if called from within the
+" tabline when the user closed a window.  This test confirms the fix.
+func Test_gettabvar_in_tabline()
+  let t:var_str = 'value'
+
+  set tabline=%{assert_equal('value',gettabvar(1,'var_str'))}
+  set showtabline=2
+
+  " Simulate the user opening a split (which becomes window #1) and then
+  " closing the split, which triggers the redrawing of the tabline.
+  leftabove split
+  redrawstatus!
+  close
+  redrawstatus!
+endfunc