summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 8f440733..af662bc3 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1374,14 +1374,17 @@ static int
termp_sh_pre(DECL_ARGS)
{
- /* No vspace between consecutive `Sh' calls. */
-
switch (n->type) {
case MDOC_BLOCK:
- if (n->prev && MDOC_Sh == n->prev->tok)
- if (NULL == n->prev->body->child)
- break;
- term_vspace(p);
+ /*
+ * Vertical space before sections, except
+ * when the previous section was empty.
+ */
+ if (n->prev == NULL ||
+ MDOC_Sh != n->prev->tok ||
+ (n->prev->body != NULL &&
+ n->prev->body->child != NULL))
+ term_vspace(p);
break;
case MDOC_HEAD:
term_fontpush(p, TERMFONT_BOLD);