diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-11-10 21:56:43 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-11-10 21:56:43 +0000 |
commit | 9f5fc2a45419c080593fe94959eb59084c7d7577 (patch) | |
tree | 316f0e769995c6e9edd3dcc8db289342c560810a | |
parent | 05b6032c19ea2ad6d01fead25c67b39fe8eeef0c (diff) | |
download | mandoc-9f5fc2a45419c080593fe94959eb59084c7d7577.tar.gz mandoc-9f5fc2a45419c080593fe94959eb59084c7d7577.tar.zst mandoc-9f5fc2a45419c080593fe94959eb59084c7d7577.zip |
add required vertical spacing before lists that begin
at the beginning of the first item of an enclosing list
right at the beginning of a new section or subsection;
minibug reported by Steffen Nurpmeso <sdaoden at yandex dot com>
-rw-r--r-- | mdoc_term.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/mdoc_term.c b/mdoc_term.c index 27f065c2..486f1afe 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.288 2014/10/30 20:10:02 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.289 2014/11/10 21:56:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -572,16 +572,18 @@ print_bvspace(struct termp *p, /* Do not vspace directly after Ss/Sh. */ - for (nn = n; nn; nn = nn->parent) { - if (MDOC_BLOCK != nn->type) - continue; - if (MDOC_Ss == nn->tok) - return; - if (MDOC_Sh == nn->tok) + nn = n; + while (nn->prev == NULL) { + do { + nn = nn->parent; + if (nn->type == MDOC_ROOT) + return; + } while (nn->type != MDOC_BLOCK); + if (nn->tok == MDOC_Sh || nn->tok == MDOC_Ss) return; - if (NULL == nn->prev) - continue; - break; + if (nn->tok == MDOC_It && + nn->parent->parent->norm->Bl.type != LIST_item) + break; } /* A `-column' does not assert vspace within the list. */ |