diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2012-07-13 14:19:49 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2012-07-13 14:19:49 +0000 |
commit | 1d9f222c71514edbb38c172df3c47de91a0113fd (patch) | |
tree | 6f01ba21f99dddc0940c8ae490e47966ef083c30 /man_term.c | |
parent | 00dbc3009d4f54812c18b39ea2af11c5f2d1b31c (diff) | |
download | mandoc-1d9f222c71514edbb38c172df3c47de91a0113fd.tar.gz |
In -man -Tascii, support .sp with negative argument.
In -mdoc -Tman, improve the framework to control vertical spacing.
Use both to support .Bl -compact (surprisingly hard to get right).
OpenBSD rev. 1.85 and 1.34, respectively.
Diffstat (limited to 'man_term.c')
-rw-r--r-- | man_term.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -440,7 +440,9 @@ pre_in(DECL_ARGS) static int pre_sp(DECL_ARGS) { + char *s; size_t i, len; + int neg; if ((NULL == n->prev && n->parent)) { if (MAN_SS == n->parent->tok) @@ -449,19 +451,32 @@ pre_sp(DECL_ARGS) return(0); } + neg = 0; switch (n->tok) { case (MAN_br): len = 0; break; default: - len = n->child ? a2height(p, n->child->string) : 1; + if (NULL == n->child) { + len = 1; + break; + } + s = n->child->string; + if ('-' == *s) { + neg = 1; + s++; + } + len = a2height(p, s); break; } if (0 == len) term_newln(p); - for (i = 0; i < len; i++) - term_vspace(p); + else if (neg) + p->skipvsp += len; + else + for (i = 0; i < len; i++) + term_vspace(p); return(0); } |