Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
28237:e79d262b9bb8 | 28238:800e7de2f96d |
---|---|
1005 call delete('Xtest_mks.out') | 1005 call delete('Xtest_mks.out') |
1006 close | 1006 close |
1007 set sessionoptions& | 1007 set sessionoptions& |
1008 endfunc | 1008 endfunc |
1009 | 1009 |
1010 " Test for mksession with and without options restores shortmess | |
1011 func Test_mksession_shortmess() | |
1012 " Without options | |
1013 set sessionoptions-=options | |
1014 split | |
1015 mksession! Xtest_mks.out | |
1016 let found_save = 0 | |
1017 let found_restore = 0 | |
1018 let lines = readfile('Xtest_mks.out') | |
1019 for line in lines | |
1020 let line = trim(line) | |
1021 | |
1022 if line ==# 'let s:shortmess_save = &shortmess' | |
1023 let found_save += 1 | |
1024 endif | |
1025 | |
1026 if found_save !=# 0 && line ==# 'let &shortmess = s:shortmess_save' | |
1027 let found_restore += 1 | |
1028 endif | |
1029 endfor | |
1030 call assert_equal(1, found_save) | |
1031 call assert_equal(1, found_restore) | |
1032 call delete('Xtest_mks.out') | |
1033 close | |
1034 set sessionoptions& | |
1035 | |
1036 " With options | |
1037 set sessionoptions+=options | |
1038 split | |
1039 mksession! Xtest_mks.out | |
1040 let found_restore = 0 | |
1041 let lines = readfile('Xtest_mks.out') | |
1042 for line in lines | |
1043 if line =~# 's:shortmess_save' | |
1044 let found_restore += 1 | |
1045 endif | |
1046 endfor | |
1047 call assert_equal(0, found_restore) | |
1048 call delete('Xtest_mks.out') | |
1049 close | |
1050 set sessionoptions& | |
1051 endfunc | |
1052 | |
1010 " Test for mksession with 'compatible' option | 1053 " Test for mksession with 'compatible' option |
1011 func Test_mksession_compatible() | 1054 func Test_mksession_compatible() |
1012 mksession! Xtest_mks1.out | 1055 mksession! Xtest_mks1.out |
1013 set compatible | 1056 set compatible |
1014 mksession! Xtest_mks2.out | 1057 mksession! Xtest_mks2.out |