aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2012-07-13 14:19:49 +0000
committerIngo Schwarze <schwarze@openbsd.org>2012-07-13 14:19:49 +0000
commita4492715d19ba56283d445fd15dccb2d28c55165 (patch)
treeaadb2a11fb8640f0659d67789d20d179d9809074 /man_term.c
parenta19c95fa6a0579b54387165ee1396f52a4f586df (diff)
downloadmandoc-a4492715d19ba56283d445fd15dccb2d28c55165.tar.gz
mandoc-a4492715d19ba56283d445fd15dccb2d28c55165.tar.zst
mandoc-a4492715d19ba56283d445fd15dccb2d28c55165.zip
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.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/man_term.c b/man_term.c
index 0524426d..14e13246 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.130 2012/07/10 19:54:11 schwarze Exp $ */
+/* $Id: man_term.c,v 1.131 2012/07/13 14:19:49 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
}