Patch 8.2.2039
Problem: Viminfo is not written when creating a new file.
Solution: Set "b_marks_read" in the new buffer. (Christian Brabandt,
closes #7350)
Files: src/bufwrite.c, src/testdir/test_viminfo.vim
*** ../vim-8.2.2038/src/bufwrite.c 2020-10-24 20:49:37.490683063 +0200
--- src/bufwrite.c 2020-11-23 22:00:50.130764711 +0100
***************
*** 2579,2584 ****
--- 2579,2590 ----
#endif
}
+ #ifdef FEAT_VIMINFO
+ // Make sure marks will be written out to the viminfo file later, even
when
+ // the file is new.
+ curbuf->b_marks_read = TRUE;
+ #endif
+
got_int |= prev_got_int;
return retval;
*** ../vim-8.2.2038/src/testdir/test_viminfo.vim 2020-08-01
16:08:14.805278012 +0200
--- src/testdir/test_viminfo.vim 2020-11-23 21:59:11.299077033 +0100
***************
*** 1,6 ****
--- 1,8 ----
" Test for reading and writing .viminfo
source check.vim
+ source term_util.vim
+ source shared.vim
function Test_viminfo_read_and_write()
" First clear 'history', so that "hislen" is zero. Then set it again,
***************
*** 879,882 ****
--- 881,912 ----
call assert_fails('set viminfo=%10', 'E528:')
endfunc
+ func Test_viminfo_oldfiles_newfile()
+ CheckRunVimInTerminal
+
+ let save_viminfo = &viminfo
+ let save_viminfofile = &viminfofile
+ set viminfo&vim
+ let v:oldfiles = []
+ let commands =<< trim [CODE]
+ set viminfofile=Xviminfofile
+ set viminfo&vim
+ w! Xnew-file.txt
+ qall
+ [CODE]
+ call writefile(commands, 'Xviminfotest')
+ let buf = RunVimInTerminal('-S Xviminfotest', #{wait_for_ruler: 0})
+ call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
+
+ let &viminfofile = 'Xviminfofile'
+ rviminfo! Xviminfofile
+ call assert_match('Xnew-file.txt$', v:oldfiles[0])
+ call assert_equal(1, len(v:oldfiles))
+ call delete('Xviminfofile')
+ call delete('Xviminfotest')
+ call delete('Xnew-file.txt')
+ let &viminfo = save_viminfo
+ let &viminfofile = save_viminfofile
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2038/src/version.c 2020-11-23 21:39:11.406594652 +0100
--- src/version.c 2020-11-23 21:55:13.551818776 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2039,
/**/
--
Apologies for taking up the bandwidth with the apology. Anything else I
can apologise for ...... er no can't think of anything, sorry about that.
Andy Hunt (Member of British Olympic Apology Squad)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202011232102.0ANL27iq1583452%40masaka.moolenaar.net.