Mercurial > vim
diff src/testdir/test_mksession.vim @ 28238:800e7de2f96d v8.2.4645
patch 8.2.4645: 'shortmess' changed when session does not store options
Commit: https://github.com/vim/vim/commit/fd01280d01c2270a320d8c962d24140a8176a400
Author: James Cherti <60946298+jamescherti@users.noreply.github.com>
Date: Tue Mar 29 12:02:57 2022 +0100
patch 8.2.4645: 'shortmess' changed when session does not store options
Problem: 'shortmess' changed when session does not store options.
Solution: Save and restore 'shortmess' if needed. (James Charti,
closes #10037)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 29 Mar 2022 13:15:03 +0200 |
parents | f1c00b8085f6 |
children | 27dcbe70e1f0 |
line wrap: on
line diff
--- a/src/testdir/test_mksession.vim +++ b/src/testdir/test_mksession.vim @@ -1007,6 +1007,49 @@ func Test_mksession_winminheight() set sessionoptions& endfunc +" Test for mksession with and without options restores shortmess +func Test_mksession_shortmess() + " Without options + set sessionoptions-=options + split + mksession! Xtest_mks.out + let found_save = 0 + let found_restore = 0 + let lines = readfile('Xtest_mks.out') + for line in lines + let line = trim(line) + + if line ==# 'let s:shortmess_save = &shortmess' + let found_save += 1 + endif + + if found_save !=# 0 && line ==# 'let &shortmess = s:shortmess_save' + let found_restore += 1 + endif + endfor + call assert_equal(1, found_save) + call assert_equal(1, found_restore) + call delete('Xtest_mks.out') + close + set sessionoptions& + + " With options + set sessionoptions+=options + split + mksession! Xtest_mks.out + let found_restore = 0 + let lines = readfile('Xtest_mks.out') + for line in lines + if line =~# 's:shortmess_save' + let found_restore += 1 + endif + endfor + call assert_equal(0, found_restore) + call delete('Xtest_mks.out') + close + set sessionoptions& +endfunc + " Test for mksession with 'compatible' option func Test_mksession_compatible() mksession! Xtest_mks1.out