patch 8.0.1024: folds lost when session file has a buffer in two windows
Problem: Manual folds are lost when a session file has the same buffer in
two windows. (Jeansen)
Solution: Use ":edit" only once. (Christian Brabandt, closes #1958)
diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim
index 6ea3255..afbc760 100644
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -121,5 +121,36 @@
argdel *
endfunc
+func Test_mksession_one_buffer_two_windows()
+ edit Xtest1
+ new Xtest2
+ split
+ mksession! Xtest_mks.out
+ let lines = readfile('Xtest_mks.out')
+ let count1 = 0
+ let count2 = 0
+ let count2buf = 0
+ for line in lines
+ if line =~ 'edit \f*Xtest1$'
+ let count1 += 1
+ endif
+ if line =~ 'edit \f\{-}Xtest2'
+ let count2 += 1
+ endif
+ if line =~ 'buffer \f\{-}Xtest2'
+ let count2buf += 1
+ endif
+ endfor
+ call assert_equal(1, count1, 'Xtest1 count')
+ call assert_equal(2, count2, 'Xtest2 count')
+ call assert_equal(2, count2buf, 'Xtest2 buffer count')
+
+ close
+ bwipe!
+ !cp Xtest_mks.out /tmp
+ call delete('Xtest_mks.out')
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab