mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.2039: viminfo is not written when creating a new file
Problem: Viminfo is not written when creating a new file. Solution: Set "b_marks_read" in the new buffer. (Christian Brabandt, closes #7350)
This commit is contained in:
@@ -2579,6 +2579,12 @@ nofail:
|
|||||||
#endif
|
#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;
|
got_int |= prev_got_int;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
" Test for reading and writing .viminfo
|
" Test for reading and writing .viminfo
|
||||||
|
|
||||||
source check.vim
|
source check.vim
|
||||||
|
source term_util.vim
|
||||||
|
source shared.vim
|
||||||
|
|
||||||
function Test_viminfo_read_and_write()
|
function Test_viminfo_read_and_write()
|
||||||
" First clear 'history', so that "hislen" is zero. Then set it again,
|
" First clear 'history', so that "hislen" is zero. Then set it again,
|
||||||
@@ -879,4 +881,32 @@ func Test_viminfo_option_error()
|
|||||||
call assert_fails('set viminfo=%10', 'E528:')
|
call assert_fails('set viminfo=%10', 'E528:')
|
||||||
endfunc
|
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: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2039,
|
||||||
/**/
|
/**/
|
||||||
2038,
|
2038,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user