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)

d7c9564d8d

Co-authored-by: LemonBoy <thatlemon@gmail.com>
This commit is contained in:
zeertzjq
2023-11-13 13:53:21 +08:00
parent 3d9593523d
commit c23c44f845
2 changed files with 45 additions and 15 deletions

View File

@@ -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