diff options
Diffstat (limited to 'man_term.c')
-rw-r--r-- | man_term.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -958,6 +958,8 @@ print_man_nodelist(DECL_ARGS) static void print_man_foot(struct termp *p, const void *arg) { + char title[BUFSIZ]; + size_t datelen; const struct man_meta *meta; meta = (const struct man_meta *)arg; @@ -967,28 +969,33 @@ print_man_foot(struct termp *p, const void *arg) term_vspace(p); term_vspace(p); term_vspace(p); + snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec); + datelen = term_strlen(p, meta->date); p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; - p->rmargin = p->maxrmargin - term_strlen(p, meta->date); p->offset = 0; - - /* term_strlen() can return zero. */ - if (p->rmargin == p->maxrmargin) - p->rmargin--; + p->rmargin = (p->maxrmargin - datelen + term_len(p, 1)) / 2; if (meta->source) term_word(p, meta->source); - if (meta->source) - term_word(p, ""); term_flushln(p); p->flags |= TERMP_NOSPACE; p->offset = p->rmargin; - p->rmargin = p->maxrmargin; - p->flags &= ~TERMP_NOBREAK; + p->rmargin = p->maxrmargin - term_strlen(p, title); + if (p->offset + datelen >= p->rmargin) + p->rmargin = p->offset + datelen; term_word(p, meta->date); term_flushln(p); + + p->flags &= ~TERMP_NOBREAK; + p->flags |= TERMP_NOSPACE; + p->offset = p->rmargin; + p->rmargin = p->maxrmargin; + + term_word(p, title); + term_flushln(p); } |