Skip to content

Commit 156919f

Browse files
committed
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)
1 parent ca291ae commit 156919f

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

src/mark.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,8 @@ handle_viminfo_mark(garray_T *values, int force)
15971597

15981598
if (fm != NULL)
15991599
{
1600-
if (vi_namedfm != NULL || fm->time_set < timestamp || force)
1600+
if (vi_namedfm != NULL || fm->fmark.mark.lnum == 0
1601+
|| fm->time_set < timestamp || force)
16011602
{
16021603
fm->fmark.mark.lnum = lnum;
16031604
fm->fmark.mark.col = col;

src/testdir/test_viminfo.vim

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Test for reading and writing .viminfo
22

3-
function Test_read_and_write()
3+
function Test_viminfo_read_and_write()
44
call histdel(':')
55
let lines = [
66
\ '# comment line',
@@ -17,7 +17,7 @@ function Test_read_and_write()
1717
let lines = readfile('Xviminfo')
1818
let done = 0
1919
for line in lines
20-
if line[0] == '|' && line !~ '^|[234],'
20+
if line[0] == '|' && line !~ '^|[234],' && line !~ '^|<'
2121
if done == 0
2222
call assert_equal('|1,4', line)
2323
elseif done == 1
@@ -469,7 +469,27 @@ func Test_viminfo_file_mark_tabclose()
469469
silent! bwipe Xtestfileintab
470470
endfunc
471471

472-
func Test_oldfiles()
472+
func Test_viminfo_file_mark_zero_time()
473+
let lines = [
474+
\ '# Viminfo version',
475+
\ '|1,4',
476+
\ '',
477+
\ '*encoding=utf-8',
478+
\ '',
479+
\ '# File marks:',
480+
\ "'B 1 0 /tmp/nothing",
481+
\ '|4,66,1,0,0,"/tmp/nothing"',
482+
\ "",
483+
\ ]
484+
call writefile(lines, 'Xviminfo')
485+
delmark B
486+
rviminfo Xviminfo
487+
call delete('Xviminfo')
488+
call assert_equal(1, line("'B"))
489+
delmark B
490+
endfunc
491+
492+
func Test_viminfo_oldfiles()
473493
let v:oldfiles = []
474494
let lines = [
475495
\ '# comment line',

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
39,
767769
/**/
768770
38,
769771
/**/

0 commit comments

Comments
 (0)