diff options
Diffstat (limited to 'mansearch.c')
-rw-r--r-- | mansearch.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mansearch.c b/mansearch.c index dfd1d39f..89601fde 100644 --- a/mansearch.c +++ b/mansearch.c @@ -199,6 +199,7 @@ mansearch(const struct mansearch *search, } mpage->names = buildnames(page); mpage->output = buildoutput(outkey, page); + mpage->bits = search->firstmatch ? rp->bits : 0; mpage->ipath = i; mpage->sec = *page->sect - '0'; if (mpage->sec < 0 || mpage->sec > 9) @@ -294,8 +295,10 @@ manmerge_term(struct expr *e, struct ohash *htab) break; slot = ohash_lookup_memory(htab, (char *)&res, sizeof(res.page), res.page); - if ((rp = ohash_find(htab, slot)) != NULL) + if ((rp = ohash_find(htab, slot)) != NULL) { + rp->bits |= res.bits; continue; + } rp = mandoc_malloc(sizeof(*rp)); *rp = res; ohash_insert(htab, slot, rp); @@ -408,7 +411,8 @@ manpage_compare(const void *vp1, const void *vp2) mp1 = vp1; mp2 = vp2; - if ((diff = mp1->sec - mp2->sec)) + if ((diff = mp2->bits - mp1->bits) || + (diff = mp1->sec - mp2->sec)) return diff; /* Fall back to alphabetic ordering of names. */ |