Hi Bram,
On Mon, Feb 12, 2018 at 1:08 PM, Bram Moolenaar <[email protected]> wrote:
>
> Yegappan wrote:
>
>> On Sun, Feb 11, 2018 at 12:27 PM, lacygoill <[email protected]>
>> wrote:
>> > Sorry, I think I was wrong. The patch did have a positive effect, but the
>> > issue doesn't not seem to be completely fixed. You don't have to execute
>> > :jumps anymore, but the output of getjumplist() is still not always
>> > consistent.
>> >
>>
>> It looks like when reading the jump list from the .viminfo file, the file
>> names
>> are not converted to buffer numbers. The buffer numbers are needed to remove
>> the duplicate entries from the jump list. When running the
>> getjumplist() or the ":jumps"
>> command the files are loaded. The next time, when you invoke the command
>> again
>> the duplicate entries are correctly removed.
>>
>> Can you try the attached patch?
>
> I would think this is also needed in ex_jumps(), since it has the same
> problem. Thus might as well move this code into cleanup_jumplist().
> Is there any place where cleanup_jumplist() is called where we don't
> actually want to create the buffers? Perhaps in
> write_viminfo_filemarks() we can skip it.
>
I am attaching a patch to do the above.
Regards,
Yegappan
--
--
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.
diff --git a/src/evalfunc.c b/src/evalfunc.c
index bdb49dd78..ef2e3211b 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4925,13 +4925,12 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
return;
list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx);
- cleanup_jumplist(wp);
+ cleanup_jumplist(wp, TRUE);
+
for (i = 0; i < wp->w_jumplistlen; ++i)
{
if (wp->w_jumplist[i].fmark.mark.lnum == 0)
continue;
- if (wp->w_jumplist[i].fmark.fnum == 0)
- fname2fnum(&wp->w_jumplist[i]);
if ((d = dict_alloc()) == NULL)
return;
if (list_append_dict(l, d) == FAIL)
diff --git a/src/mark.c b/src/mark.c
index 9ebc9c24c..226b384b8 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -221,7 +221,7 @@ movemark(int count)
pos_T *pos;
xfmark_T *jmp;
- cleanup_jumplist(curwin);
+ cleanup_jumplist(curwin, TRUE);
if (curwin->w_jumplistlen == 0) /* nothing to jump to */
return (pos_T *)NULL;
@@ -891,7 +891,7 @@ ex_jumps(exarg_T *eap UNUSED)
int i;
char_u *name;
- cleanup_jumplist(curwin);
+ cleanup_jumplist(curwin, TRUE);
/* Highlight title */
MSG_PUTS_TITLE(_("\n jump line col file/text"));
@@ -1305,11 +1305,25 @@ mark_col_adjust(
* jumplist. They will be removed here for the specified window.
*/
void
-cleanup_jumplist(win_T *wp)
+cleanup_jumplist(win_T *wp, int loadfiles)
{
int i;
int from, to;
+ if (loadfiles)
+ {
+ /*
+ * If specified, load all the files from the jump list. This is
+ * needed to properly clean up duplicate entries.
+ */
+ for (i = 0; i < wp->w_jumplistlen; ++i)
+ {
+ if ((wp->w_jumplist[i].fmark.fnum == 0) &&
+ (wp->w_jumplist[i].fmark.mark.lnum != 0))
+ fname2fnum(&wp->w_jumplist[i]);
+ }
+ }
+
to = 0;
for (from = 0; from < wp->w_jumplistlen; ++from)
{
@@ -1738,7 +1752,7 @@ write_viminfo_filemarks(FILE *fp)
/* Write the jumplist with -' */
fputs(_("\n# Jumplist (newest first):\n"), fp);
setpcmark(); /* add current cursor position */
- cleanup_jumplist(curwin);
+ cleanup_jumplist(curwin, FALSE);
vi_idx = 0;
idx = curwin->w_jumplistlen - 1;
for (i = 0; i < JUMPLISTSIZE; ++i)
diff --git a/src/proto/mark.pro b/src/proto/mark.pro
index aa6f44efc..448b45273 100644
--- a/src/proto/mark.pro
+++ b/src/proto/mark.pro
@@ -24,7 +24,7 @@ void mark_adjust_nofold(linenr_T line1, linenr_T line2, long
amount, long amount
void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long
col_amount);
void copy_jumplist(win_T *from, win_T *to);
void free_jumplist(win_T *wp);
-void cleanup_jumplist(win_T *wp);
+void cleanup_jumplist(win_T *wp, int loadfiles);
void set_last_cursor(win_T *win);
void free_all_marks(void);
int read_viminfo_filemark(vir_T *virp, int force);