changeset 10285:cd16ef948ad1 v8.0.0039

commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 15 20:46:20 2016 +0200 patch 8.0.0039 Problem: When Vim 8 reads an old viminfo and exits, the next time marks are not read from viminfo. (Ned Batchelder) Solution: Set a mark when it wasn't set before, even when the timestamp is zero. (closes #1170)
author Christian Brabandt <cb@256bit.org>
date Sat, 15 Oct 2016 21:00:04 +0200
parents dc7f7a0a1ed4
children 804761fded93
files src/mark.c src/testdir/test_viminfo.vim src/version.c
diffstat 3 files changed, 27 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/mark.c
+++ b/src/mark.c
@@ -1597,7 +1597,8 @@ handle_viminfo_mark(garray_T *values, in
 
     if (fm != NULL)
     {
-	if (vi_namedfm != NULL || fm->time_set < timestamp || force)
+	if (vi_namedfm != NULL || fm->fmark.mark.lnum == 0
+					  || fm->time_set < timestamp || force)
 	{
 	    fm->fmark.mark.lnum = lnum;
 	    fm->fmark.mark.col = col;
--- a/src/testdir/test_viminfo.vim
+++ b/src/testdir/test_viminfo.vim
@@ -1,6 +1,6 @@
 " Test for reading and writing .viminfo
 
-function Test_read_and_write()
+function Test_viminfo_read_and_write()
   call histdel(':')
   let lines = [
 	\ '# comment line',
@@ -17,7 +17,7 @@ function Test_read_and_write()
   let lines = readfile('Xviminfo')
   let done = 0
   for line in lines
-    if line[0] == '|' && line !~ '^|[234],'
+    if line[0] == '|' && line !~ '^|[234],' && line !~ '^|<'
       if done == 0
 	call assert_equal('|1,4', line)
       elseif done == 1
@@ -469,7 +469,27 @@ func Test_viminfo_file_mark_tabclose()
   silent! bwipe Xtestfileintab
 endfunc
 
-func Test_oldfiles()
+func Test_viminfo_file_mark_zero_time()
+  let lines = [
+	\ '# Viminfo version',
+	\ '|1,4',
+	\ '',
+	\ '*encoding=utf-8',
+	\ '',
+	\ '# File marks:',
+	\ "'B  1  0  /tmp/nothing",
+	\ '|4,66,1,0,0,"/tmp/nothing"',
+	\ "",
+	\ ]
+  call writefile(lines, 'Xviminfo')
+  delmark B
+  rviminfo Xviminfo
+  call delete('Xviminfo')
+  call assert_equal(1, line("'B"))
+  delmark B
+endfunc
+
+func Test_viminfo_oldfiles()
   let v:oldfiles = []
   let lines = [
 	\ '# comment line',
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    39,
+/**/
     38,
 /**/
     37,