diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-04-04 11:43:54 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-04-04 11:43:54 +0000 |
commit | dad7c5cadaecadd557fe3b1bb702f7ec544b7fef (patch) | |
tree | c51e24b269b50b8be90ebfba6da684130299fd5f | |
parent | 38bc39e549b0c81b331434b77d2d88d38105392e (diff) |
Fix a quirk with respect to empty .HP.
Found while writing a regression test for man_macro.c rev. 1.66.
Incidentally, this brings rendering of XFreeEventData(3) closer to groff.
-rw-r--r-- | regress/usr.bin/mandoc/man/RS/nested.in | 11 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/man/RS/nested.out_ascii | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/man_term.c | 13 |
3 files changed, 27 insertions, 5 deletions
diff --git a/regress/usr.bin/mandoc/man/RS/nested.in b/regress/usr.bin/mandoc/man/RS/nested.in index 03c4b43c39d..ca440e3f295 100644 --- a/regress/usr.bin/mandoc/man/RS/nested.in +++ b/regress/usr.bin/mandoc/man/RS/nested.in @@ -1,4 +1,4 @@ -.TH RS-NESTED 1 "November 18, 2012" OpenBSD +.TH RS-NESTED 1 "April 4, 2015" OpenBSD .SH NAME RS-nested \- various blocks nested inside reset blocks .SH DESCRIPTION @@ -34,4 +34,11 @@ and which indent the next line will have - hopefully 12n. .PP outer text .RE -regular text +nesting HP and RS inside RS: +.RS +outer text +.HP 2n +.RS 4n +inner text +.RE +.RE diff --git a/regress/usr.bin/mandoc/man/RS/nested.out_ascii b/regress/usr.bin/mandoc/man/RS/nested.out_ascii index f0aeae08323..cb599754e91 100644 --- a/regress/usr.bin/mandoc/man/RS/nested.out_ascii +++ b/regress/usr.bin/mandoc/man/RS/nested.out_ascii @@ -24,8 +24,12 @@ DDEESSCCRRIIPPTTIIOONN hopefully 12n. outer text - regular text + nesting HP and RS inside RS: + outer text + + + inner text -OpenBSD November 18, 2012 RS-NESTED(1) +OpenBSD April 4, 2015 RS-NESTED(1) diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 131d552344b..1314cd519a5 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.126 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.127 2015/04/04 11:43:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -531,6 +531,17 @@ post_HP(DECL_ARGS) switch (n->type) { case ROFFT_BODY: term_newln(p); + + /* + * Compatibility with a groff bug. + * The .HP macro uses the undocumented .tag request + * which causes a line break and cancels no-space + * mode even if there isn't any output. + */ + + if (n->child == NULL) + term_vspace(p); + p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); p->trailspace = 0; p->offset = mt->offset; |