aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-31 10:04:12 +0800
committerGitHub <noreply@github.com>2022-03-31 10:04:12 +0800
commitb6e3a2dbbb4c408c21dc58723d8dd3d68053f0cb (patch)
tree2d18fa50a5098abf71c1aa2ea140893e26950db4 /src/nvim/testdir
parent0d4bd420c19e3a81b494ec1f58cffde53d9b84ea (diff)
downloadrneovim-b6e3a2dbbb4c408c21dc58723d8dd3d68053f0cb.tar.gz
rneovim-b6e3a2dbbb4c408c21dc58723d8dd3d68053f0cb.tar.bz2
rneovim-b6e3a2dbbb4c408c21dc58723d8dd3d68053f0cb.zip
vim-patch:8.2.4645: 'shortmess' changed when session does not store options (#17908)
Problem: 'shortmess' changed when session does not store options. Solution: Save and restore 'shortmess' if needed. (James Charti, closes vim/vim#10037) https://github.com/vim/vim/commit/fd01280d01c2270a320d8c962d24140a8176a400
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_mksession.vim43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim
index 798cb9e54f..5dbe2cd366 100644
--- a/src/nvim/testdir/test_mksession.vim
+++ b/src/nvim/testdir/test_mksession.vim
@@ -795,6 +795,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()
throw 'skipped: Nvim does not support "compatible" option'