summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nav.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/nav.c b/nav.c
index 6d81ddd..83826dc 100644
--- a/nav.c
+++ b/nav.c
@@ -28,8 +28,10 @@ void nav_push(struct nav_state *ns, struct doc d) {
 	if (ns->histc == HIST_MAX) {
 		doc_fini(ns->histv);
 		memmove(ns->histv, &ns->histv[1], sizeof(struct doc) * (HIST_MAX - 1));
+		memmove(ns->cur_ofs, &ns->cur_ofs[1], sizeof(size_t) * (HIST_MAX - 1));
 		ns->histc--;
 	}
+	ns->cur_ofs[ns->histc] = 0;
 	ns->histv[ns->histc++] = d;
 	ns->cur_doc = ns->histc - 1;
 }