Patch 7.4.1932
Problem: When writing viminfo the jumplist is not merged with the one in
the viminfo file.
Solution: Merge based on timestamp.
Files: src/mark.c, src/testdir/test_viminfo.vim
*** ../vim-7.4.1931/src/mark.c 2016-06-12 21:20:50.933837514 +0200
--- src/mark.c 2016-06-13 22:12:02.674716193 +0200
***************
*** 1518,1524 ****
--- 1518,1530 ----
{
for (idx = curwin->w_jumplistlen - 1; idx >= 0; --idx)
if (curwin->w_jumplist[idx].time_set < timestamp)
+ {
+ ++idx;
break;
+ }
+ if (idx < 0 && curwin->w_jumplistlen < JUMPLISTSIZE)
+ /* insert as the oldest entry */
+ idx = 0;
}
else if (curwin->w_jumplistlen < JUMPLISTSIZE)
/* insert as oldest entry */
***************
*** 1538,1544 ****
else
{
/* Move newer entries forward. */
- ++idx;
for (i = curwin->w_jumplistlen; i > idx; --i)
curwin->w_jumplist[i] = curwin->w_jumplist[i - 1];
++curwin->w_jumplistidx;
--- 1544,1549 ----
***************
*** 1684,1693 ****
fputs(_("\n# Jumplist (newest first):\n"), fp);
setpcmark(); /* add current cursor position */
cleanup_jumplist();
! /* TODO: when vi_jumplist != NULL merge the two lists. */
! for (fm = &curwin->w_jumplist[curwin->w_jumplistlen - 1];
! fm >= &curwin->w_jumplist[0]; --fm)
! {
if (fm->fmark.fnum == 0
|| ((buf = buflist_findnr(fm->fmark.fnum)) != NULL
&& !removable(buf->b_ffname)))
--- 1689,1711 ----
fputs(_("\n# Jumplist (newest first):\n"), fp);
setpcmark(); /* add current cursor position */
cleanup_jumplist();
! vi_idx = 0;
! idx = curwin->w_jumplistlen - 1;
! for (i = 0; i < JUMPLISTSIZE; ++i)
! {
! xfmark_T *vi_fm;
!
! fm = idx >= 0 ? &curwin->w_jumplist[idx] : NULL;
! vi_fm = vi_idx < vi_jumplist_len ? &vi_jumplist[vi_idx] : NULL;
! if (fm == NULL && vi_fm == NULL)
! break;
! if (fm == NULL || (vi_fm != NULL && fm->time_set < vi_fm->time_set))
! {
! fm = vi_fm;
! ++vi_idx;
! }
! else
! --idx;
if (fm->fmark.fnum == 0
|| ((buf = buflist_findnr(fm->fmark.fnum)) != NULL
&& !removable(buf->b_ffname)))
*** ../vim-7.4.1931/src/testdir/test_viminfo.vim 2016-06-12
21:20:50.941837428 +0200
--- src/testdir/test_viminfo.vim 2016-06-13 22:18:16.034689241 +0200
***************
*** 309,314 ****
--- 309,341 ----
exe "normal \<C-O>"
call assert_equal('time 05', getline('.'))
+ clearjumps
+ call cursor(1, 1)
+ call test_settime(5)
+ exe "normal /15\r"
+ call test_settime(15)
+ exe "normal /last pos\r"
+ call test_settime(40)
+ exe "normal ?30\r"
+ " Test merge when writing
+ wviminfo Xviminfo
+ clearjumps
+ rviminfo Xviminfo
+
+ exe "normal \<C-O>"
+ call assert_equal('time 30', getline('.'))
+ exe "normal \<C-O>"
+ call assert_equal('last pos', getline('.'))
+ exe "normal \<C-O>"
+ " duplicate for 'time 30' was removed
+ call assert_equal('time 20', getline('.'))
+ exe "normal \<C-O>"
+ call assert_equal('time 15', getline('.'))
+ exe "normal \<C-O>"
+ call assert_equal('time 10', getline('.'))
+ exe "normal \<C-O>"
+ call assert_equal('time 05', getline('.'))
+
bwipe!
call delete('Xviminfo')
endfunc
*** ../vim-7.4.1931/src/version.c 2016-06-13 21:15:59.575470541 +0200
--- src/version.c 2016-06-13 22:21:32.272573888 +0200
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 1932,
/**/
--
>From "know your smileys":
2B|^2B Message from Shakespeare
/// 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].
For more options, visit https://groups.google.com/d/optout.