diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-03 17:47:26 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-03 17:47:26 +0200 |
commit | ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd (patch) | |
tree | 2f0ec77daa7639d59485f19ea7e2e019cd1b5fb8 /src/ex_cmds.c | |
parent | dec85cf75044ed94f611c825a7a0b0050a2597b9 (diff) | |
download | vim-git-ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd.tar.gz |
patch 7.4.1988v7.4.1988
Problem: When updating viminfo with file marks there is no time order.
Solution: Remember the time when a buffer was last used, store marks for
the most recently used buffers.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 72603d1bd..5900c86d3 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2148,10 +2148,11 @@ viminfo_filename(char_u *file) static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags) { - int count = 0; int eof = FALSE; vir_T vir; int merge = FALSE; + int do_copy_marks = FALSE; + garray_T buflist; if ((vir.vir_line = alloc(LSIZE)) == NULL) return; @@ -2183,7 +2184,11 @@ do_viminfo(FILE *fp_in, FILE *fp_out, int flags) while (!(eof = viminfo_readline(&vir)) && vir.vir_line[0] != '>') ; + + do_copy_marks = (flags & + (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)); } + if (fp_out != NULL) { /* Write the info: */ @@ -2209,11 +2214,18 @@ do_viminfo(FILE *fp_in, FILE *fp_out, int flags) finish_viminfo_marks(); write_viminfo_bufferlist(fp_out); write_viminfo_barlines(&vir, fp_out); - count = write_viminfo_marks(fp_out); + + if (do_copy_marks) + ga_init2(&buflist, sizeof(buf_T *), 50); + write_viminfo_marks(fp_out, do_copy_marks ? &buflist : NULL); + } + + if (do_copy_marks) + { + copy_viminfo_marks(&vir, fp_out, &buflist, eof, flags); + if (fp_out != NULL) + ga_clear(&buflist); } - if (fp_in != NULL - && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT))) - copy_viminfo_marks(&vir, fp_out, count, eof, flags); vim_free(vir.vir_line); #ifdef FEAT_MBYTE @@ -4287,6 +4299,10 @@ do_ecmd( msg_scrolled_ign = FALSE; } +#ifdef FEAT_VIMINFO + curbuf->b_last_used = vim_time(); +#endif + if (command != NULL) do_cmdline(command, NULL, NULL, DOCMD_VERBOSE); |