From 2493fd020d6f294c78a87b0f7f35c0398b248f1f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 13 Feb 2024 07:27:27 +0800 Subject: vim-patch:9.1.0102: settabvar() may change the last accessed tabpage (#27450) Problem: settabvar() may change the last accessed tabpage. Solution: Save and restore lastused_tabpage. (zeertzjq) closes: vim/vim#14017 https://github.com/vim/vim/commit/b47fbb40837512cdd2d8c25eaf9952154836b99d --- test/old/testdir/test_tabpage.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_tabpage.vim b/test/old/testdir/test_tabpage.vim index adb9e13269..0f038c8bee 100644 --- a/test/old/testdir/test_tabpage.vim +++ b/test/old/testdir/test_tabpage.vim @@ -995,4 +995,21 @@ func Test_tabpage_drop_tabmove() bwipe! endfunc +" Test that settabvar() shouldn't change the last accessed tabpage. +func Test_lastused_tabpage_settabvar() + tabonly! + tabnew + tabnew + tabnew + call assert_equal(3, tabpagenr('#')) + + call settabvar(2, 'myvar', 'tabval') + call assert_equal('tabval', gettabvar(2, 'myvar')) + call assert_equal(3, tabpagenr('#')) + + bwipe! + bwipe! + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit