diff src/testdir/test_mksession.vim @ 23812:84089558c5df v8.2.2447

patch 8.2.2447: 'foldlevel' not applied to folds restored from session Commit: https://github.com/vim/vim/commit/f9547eb6ef02e305203b859d2dcfdae930b9d544 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 1 19:24:55 2021 +0100 patch 8.2.2447: 'foldlevel' not applied to folds restored from session Problem: 'foldlevel' not applied to folds restored from session. Solution: Set 'foldlevel' after creaiting the folds. (closes https://github.com/vim/vim/issues/7767)
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Feb 2021 19:30:04 +0100
parents 855b818aae9b
children a2f13e56b0e7
line wrap: on
line diff
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -504,6 +504,32 @@ func Test_mkview_terminal_windows()
   call delete('Xtestview')
 endfunc
 
+func Test_mkview_open_folds()
+  enew!
+
+  call append(0, ['a', 'b', 'c'])
+  1,3fold
+  " zR affects 'foldlevel', make sure the option is applied after the folds
+  " have been recreated.
+  normal zR
+  write! Xtestfile
+
+  call assert_equal(-1, foldclosed(1))
+  call assert_equal(-1, foldclosed(2))
+  call assert_equal(-1, foldclosed(3))
+
+  mkview! Xtestview
+  source Xtestview
+
+  call assert_equal(-1, foldclosed(1))
+  call assert_equal(-1, foldclosed(2))
+  call assert_equal(-1, foldclosed(3))
+
+  call delete('Xtestview')
+  call delete('Xtestfile')
+  %bwipe
+endfunc
+
 " Test :mkview with a file argument.
 func Test_mkview_file()
   " Create a view with line number and a fold.