aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-13 13:53:21 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-11-13 13:58:32 +0800
commitc23c44f845c8d357093d87f6e2e5636d2a11a8fb (patch)
treef220a9b3337ba1eed73c4cc9269cf88c1ff2db5c /test
parent3d9593523d0b3a4280f8f661818a7da0106556d4 (diff)
downloadrneovim-c23c44f845c8d357093d87f6e2e5636d2a11a8fb.tar.gz
rneovim-c23c44f845c8d357093d87f6e2e5636d2a11a8fb.tar.bz2
rneovim-c23c44f845c8d357093d87f6e2e5636d2a11a8fb.zip
vim-patch:8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Problem: Mksession mixes up "tabpages" and "curdir" arguments. Solution: Correct logic for storing tabpage in session. (closes vim/vim#10312) https://github.com/vim/vim/commit/d7c9564d8d24343f2e27205633032dd6ebe5232c Co-authored-by: LemonBoy <thatlemon@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_mksession.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/old/testdir/test_mksession.vim b/test/old/testdir/test_mksession.vim
index 86759f026c..d63d10b44c 100644
--- a/test/old/testdir/test_mksession.vim
+++ b/test/old/testdir/test_mksession.vim
@@ -803,6 +803,35 @@ func Test_mksession_sesdir()
call delete('Xproj', 'rf')
endfunc
+" Test for saving and restoring the tab-local working directory when there is
+" only a single tab and 'tabpages' is not in 'sessionoptions'.
+func Test_mksession_tcd_single_tabs()
+ only | tabonly
+
+ let save_cwd = getcwd()
+ set sessionoptions-=tabpages
+ set sessionoptions+=curdir
+ call mkdir('Xtopdir1')
+ call mkdir('Xtopdir2')
+
+ " There are two tab pages, the current one has local cwd set to 'Xtopdir2'.
+ exec 'tcd ' .. save_cwd .. '/Xtopdir1'
+ tabnew
+ exec 'tcd ' .. save_cwd .. '/Xtopdir2'
+ mksession! Xtest_tcd_single
+
+ source Xtest_tcd_single
+ " call assert_equal(2, haslocaldir())
+ call assert_equal(1, haslocaldir(-1))
+ call assert_equal('Xtopdir2', fnamemodify(getcwd(-1, 0), ':t'))
+ %bwipe
+
+ set sessionoptions&
+ call chdir(save_cwd)
+ call delete('Xtopdir1', 'rf')
+ call delete('Xtopdir2', 'rf')
+endfunc
+
" Test for storing the 'lines' and 'columns' settings
func Test_mksession_resize()
mksession! Xtest_mks1.out