diff src/evalfunc.c @ 13248:5958573d8a72 v8.0.1498

patch 8.0.1498: getjumplist() returns duplicate entries commit https://github.com/vim/vim/commit/a7e18d237f817637815f0de44b08df1e0ca0f4f9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 11 14:29:49 2018 +0100 patch 8.0.1498: getjumplist() returns duplicate entries Problem: Getjumplist() returns duplicate entries. (lacygoill) Solution: Call cleanup_jumplist(). (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sun, 11 Feb 2018 14:30:06 +0100
parents dd3b2ecf91f6
children 69278c25429d
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4871,8 +4871,13 @@ f_getjumplist(typval_T *argvars, typval_
 	return;
     list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx);
 
+    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)
@@ -4886,7 +4891,7 @@ f_getjumplist(typval_T *argvars, typval_
 		NULL);
 # endif
 	dict_add_nr_str(d, "bufnr", (long)wp->w_jumplist[i].fmark.fnum, NULL);
-	if (wp->w_jumplist[i].fmark.fnum == 0)
+	if (wp->w_jumplist[i].fname != NULL)
 	    dict_add_nr_str(d, "filename", 0L, wp->w_jumplist[i].fname);
     }
 #endif