From 7d43ad487e7358b3a013d223a8e3cb0bb5304f64 Mon Sep 17 00:00:00 2001 From: wrmr Date: Sun, 3 Nov 2024 13:51:33 -0500 Subject: fix bug of not setting current offset to zero for new docs --- nav.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nav.c') 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; } -- cgit 1.4.1-2-gfad0