patch 7.4.1131
Problem: New lines in the viminfo file are dropped.
Solution: Copy lines starting with "|". Fix that when using :rviminfo in a
function global variables were restored as function-local
variables.
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 33d76ba..a5b8cd3 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -63,7 +63,6 @@
test70.out \
test71.out \
test73.out \
- test74.out \
test75.out \
test76.out \
test77.out \
@@ -176,10 +175,11 @@
test_cdo.res \
test_hardcopy.res \
test_increment.res \
+ test_perl.res \
test_quickfix.res \
+ test_viminfo.res \
test_viml.res \
- test_alot.res \
- test_perl.res
+ test_alot.res
# Explicit dependencies.
diff --git a/src/testdir/test74.in b/src/testdir/test74.in
deleted file mode 100644
index 4fbe5e4..0000000
--- a/src/testdir/test74.in
+++ /dev/null
@@ -1,36 +0,0 @@
-" Tests for storing global variables in the .viminfo file vim: set ft=vim:
-
-STARTTEST
-:so small.vim
-:" Do all test in a separate window to avoid E211 when we recursively
-:" delete the Xfind directory during cleanup
-:"
-:" This will cause a few errors, do it silently.
-:set visualbell
-:set nocp viminfo+=!,nviminfo
-:let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}
-:" store a really long list, so line wrapping will occur in viminfo file
-:let MY_GLOBAL_LIST=range(1,100)
-:wv! Xviminfo
-:unlet MY_GLOBAL_DICT
-:unlet MY_GLOBAL_LIST
-:rv! Xviminfo
-:call delete('Xviminfo')
-:if exists("MY_GLOBAL_DICT")
-:redir >> test.out
-:echo MY_GLOBAL_DICT
-:redir end
-:endif
-:if exists("MY_GLOBAL_LIST")
-:redir >> test.out
-:echo MY_GLOBAL_LIST
-:redir end
-:endif
-:redir >> test.out
-:echo "foobar"
-:redir end
-:endif
-:qa!
-ENDTEST
-
-eof
diff --git a/src/testdir/test74.ok b/src/testdir/test74.ok
deleted file mode 100644
index b026c33..0000000
--- a/src/testdir/test74.ok
+++ /dev/null
@@ -1,5 +0,0 @@
-
-{'foo': 1, 'longvarible': 1000, 'bar': 0}
-[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
-
-foobar
diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim
new file mode 100644
index 0000000..3efe75e
--- /dev/null
+++ b/src/testdir/test_viminfo.vim
@@ -0,0 +1,50 @@
+" Test for reading and writing .viminfo
+
+function Test_read_and_write()
+ let lines = [
+ \ '# comment line',
+ \ '*encoding=utf-8',
+ \ '~MSle0~/asdf',
+ \ '|copied as-is',
+ \ '|and one more',
+ \ ]
+ call writefile(lines, 'Xviminfo')
+ rviminfo Xviminfo
+ call assert_equal('asdf', @/)
+
+ wviminfo Xviminfo
+ let lines = readfile('Xviminfo')
+ let done = 0
+ for line in lines
+ if line[0] == '|'
+ if done == 0
+ call assert_equal('|copied as-is', line)
+ elseif done == 1
+ call assert_equal('|and one more', line)
+ endif
+ let done += 1
+ endif
+ endfor
+ call assert_equal(2, done)
+
+ call delete('Xviminfo')
+endfunc
+
+func Test_global_vars()
+ let test_dict = {'foo': 1, 'bar': 0, 'longvarible': 1000}
+ let g:MY_GLOBAL_DICT = test_dict
+ " store a really long list, so line wrapping will occur in viminfo file
+ let test_list = range(1,100)
+ let g:MY_GLOBAL_LIST = test_list
+ set viminfo='100,<50,s10,h,!
+ wv! Xviminfo
+ unlet g:MY_GLOBAL_DICT
+ unlet g:MY_GLOBAL_LIST
+
+ rv! Xviminfo
+ call assert_equal(test_dict, g:MY_GLOBAL_DICT)
+ call assert_equal(test_list, g:MY_GLOBAL_LIST)
+
+ call delete('Xviminfo')
+ set viminfo-=!
+endfunc