aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c6
-rw-r--r--src/nvim/mark.c24
-rw-r--r--src/nvim/shada.c2
3 files changed, 21 insertions, 11 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 5c1c722a61..a7b74b322f 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -10064,14 +10064,12 @@ static void f_getjumplist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_list_append_list(rettv->vval.v_list, l);
tv_list_append_number(rettv->vval.v_list, wp->w_jumplistidx);
- cleanup_jumplist(wp);
+ cleanup_jumplist(wp, true);
+
for (int 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]);
- }
dict_T *const d = tv_dict_alloc();
tv_list_append_dict(l, d);
tv_dict_add_nr(d, S_LEN("lnum"), wp->w_jumplist[i].fmark.mark.lnum);
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 64b7b2e002..907cfe4833 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -214,7 +214,7 @@ pos_T *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;
@@ -463,7 +463,7 @@ getnextmark (
* This is used for marks obtained from the .shada file. It's postponed
* until the mark is used to avoid a long startup delay.
*/
-void fname2fnum(xfmark_T *fm)
+static void fname2fnum(xfmark_T *fm)
{
char_u *p;
@@ -781,13 +781,11 @@ void ex_jumps(exarg_T *eap)
int i;
char_u *name;
- cleanup_jumplist(curwin);
+ cleanup_jumplist(curwin, true);
/* Highlight title */
MSG_PUTS_TITLE(_("\n jump line col file/text"));
for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) {
if (curwin->w_jumplist[i].fmark.mark.lnum != 0) {
- if (curwin->w_jumplist[i].fmark.fnum == 0)
- fname2fnum(&curwin->w_jumplist[i]);
name = fm_getname(&curwin->w_jumplist[i].fmark, 16);
if (name == NULL) /* file name not available */
continue;
@@ -1158,11 +1156,25 @@ void mark_col_adjust(
// When deleting lines, this may create duplicate marks in the
// jumplist. They will be removed here for the specified window.
-void cleanup_jumplist(win_T *wp)
+// When "loadfiles" is true first ensure entries have the "fnum" field set
+// (this may be a bit slow).
+void cleanup_jumplist(win_T *wp, bool 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, but will take some
+ // time.
+ 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) {
if (wp->w_jumplistidx == from)
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 9f376ef9a0..4440d3905f 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -2739,7 +2739,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
// Initialize jump list
const void *jump_iter = NULL;
- cleanup_jumplist(curwin);
+ cleanup_jumplist(curwin, false);
setpcmark();
do {
xfmark_T fm;