diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2010-09-23 20:40:00 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2010-09-23 20:40:00 +0000 |
commit | cdf9665ab8e07c6d9c3aa3b35f3f192a2bfe7145 (patch) | |
tree | 1b24992604e3b153a641cdff2dbf83df49d83083 /mdoc_term.c | |
parent | ea12b114dd971f59e297b5fe17e30363a0e57aa9 (diff) | |
download | mandoc-cdf9665ab8e07c6d9c3aa3b35f3f192a2bfe7145.tar.gz |
When the HEAD of an .Nm block in the SYNOPSIS might be wider
than the column containing it, the TERMP_HANG flag is required,
but avoid the flag when we know that the HEAD is shorter,
because in that case, the flag might ruin the alignment.
Problem originally reported by jmc@, who also spotted a regression
in an earlier version of this patch.
"feel free to commit" kristaps@
Diffstat (limited to 'mdoc_term.c')
-rw-r--r-- | mdoc_term.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mdoc_term.c b/mdoc_term.c index ff8d47aa..5d758372 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1031,12 +1031,18 @@ termp_nm_pre(DECL_ARGS) synopsis_pre(p, n->parent); if (MDOC_HEAD == n->type && n->next->child) { - p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_HANG; - p->rmargin = p->offset + term_len(p, 1) + - (NULL == n->child ? term_strlen(p, m->name) : - MDOC_TEXT == n->child->type ? - term_strlen(p, n->child->string) : - term_len(p, 5)); + p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; + p->rmargin = p->offset + term_len(p, 1); + if (NULL == n->child) { + p->rmargin += term_strlen(p, m->name); + } else if (MDOC_TEXT == n->child->type) { + p->rmargin += term_strlen(p, n->child->string); + if (n->child->next) + p->flags |= TERMP_HANG; + } else { + p->rmargin += term_len(p, 5); + p->flags |= TERMP_HANG; + } } term_fontpush(p, TERMFONT_BOLD); |