summary refs log tree commit diff
path: root/nav.c
diff options
context:
space:
mode:
authorwrmr2024-11-03 13:51:33 -0500
committerwrmr2024-11-03 13:51:33 -0500
commit7d43ad487e7358b3a013d223a8e3cb0bb5304f64 (patch)
tree6a4b75019a4b2d3ed46c393eed3e9cdee8d13df4 /nav.c
parent83c5636c208eeffb20be90e67836233783d4c85d (diff)
fix bug of not setting current offset to zero for new docs
Diffstat (limited to 'nav.c')
-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;
 }