Hi,
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?
Thanks,
Yegappan
>
> I don't know whether you'll be able to reproduce, because it probably
> depends on the information stored in ~/.viminfo, but when I start Vim with
> no configuration:
>
> vim -Nu NONE
>
> Then, the 1st invocation of getjumplist() still contains duplicates. After
> that, the next invocations do not. I've checked by executing:
>
> :echo len(getjumplist()[0])
>
> The 1st time, the number is much bigger than the next times (something like
> 55 vs 19).
>
> That being said, I can't always reproduce in a normal session with a custom
> configuration, it depends on the file or window in which I am.
>
--
--
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..1135b3920 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4925,13 +4925,25 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
return;
list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx);
+ /*
+ * Get the file number for all the filenames in the jump list.
+ * This is needed to remove duplicate entries.
+ * When reading the jump list from the .viminfo file, the file numbers
+ * are not set to avoid a long startup delay.
+ */
+ for (i = 0; i < wp->w_jumplistlen; ++i)
+ {
+ if ((wp->w_jumplist[i].fmark.mark.lnum != 0) &&
+ (wp->w_jumplist[i].fmark.fnum == 0))
+ fname2fnum(&wp->w_jumplist[i]);
+ }
+
cleanup_jumplist(wp);
+
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)