summaryrefslogtreecommitdiffstats
path: root/src/mark.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mark.c')
-rw-r--r--src/mark.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mark.c b/src/mark.c
index 22e3c62..9f6a9cc 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -130,6 +130,38 @@ setmark_pos(int c, pos_T *pos, int fnum)
}
/*
+ * Delete every entry referring to file 'fnum' from both the jumplist and the
+ * tag stack.
+ */
+ void
+mark_forget_file(win_T *wp, int fnum)
+{
+ int i;
+
+ for (i = wp->w_jumplistlen - 1; i >= 0; --i)
+ if (wp->w_jumplist[i].fmark.fnum == fnum)
+ {
+ vim_free(wp->w_jumplist[i].fname);
+ if (wp->w_jumplistidx > i)
+ --wp->w_jumplistidx;
+ --wp->w_jumplistlen;
+ mch_memmove(&wp->w_jumplist[i], &wp->w_jumplist[i + 1],
+ (wp->w_jumplistlen - i) * sizeof(wp->w_jumplist[i]));
+ }
+
+ for (i = wp->w_tagstacklen - 1; i >= 0; --i)
+ if (wp->w_tagstack[i].fmark.fnum == fnum)
+ {
+ tagstack_clear_entry(&wp->w_tagstack[i]);
+ if (wp->w_tagstackidx > i)
+ --wp->w_tagstackidx;
+ --wp->w_tagstacklen;
+ mch_memmove(&wp->w_tagstack[i], &wp->w_tagstack[i + 1],
+ (wp->w_tagstacklen - i) * sizeof(wp->w_tagstack[i]));
+ }
+}
+
+/*
* Set the previous context mark to the current position and add it to the
* jump list.
*/