summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2010-12-11 14:40:51 +0000
committerIngo Schwarze <schwarze@openbsd.org>2010-12-11 14:40:51 +0000
commit3ba7e2970c056ac74cdea3501302bb3151ca70d0 (patch)
tree1e1924b54148c5718cf33f89dad061c21e8d4dde /mdoc_term.c
parent81689ffd1549a3846ce2cda5142974f268795426 (diff)
downloadmandoc-3ba7e2970c056ac74cdea3501302bb3151ca70d0.tar.gz
mandoc-3ba7e2970c056ac74cdea3501302bb3151ca70d0.tar.zst
mandoc-3ba7e2970c056ac74cdea3501302bb3151ca70d0.zip
Make SYNOPSIS sections and code having .nr nS enabled
behave as if the whole code were wrapped in .Bk/.Ek, i.e. keeping input lines together on output lines. This is compatible with new groff behaviour and deviates from historical groff. Tweaked version of a patch sent by kristaps@ on July 16, 2010. ok kristaps@ jmc@ sobrado@ millert@
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index bdc16100..98b4fa70 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.196 2010/12/05 15:37:30 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.197 2010/12/11 14:40:51 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -319,9 +319,12 @@ print_mdoc_node(DECL_ARGS)
/*
* Keeps only work until the end of a line. If a keep was
* invoked in a prior line, revert it to PREKEEP.
+ *
+ * Also let SYNPRETTY sections behave as if they were wrapped
+ * in a `Bk' block.
*/
- if (TERMP_KEEP & p->flags) {
+ if (TERMP_KEEP & p->flags || MDOC_SYNPRETTY & n->flags) {
if (n->prev && n->prev->line != n->line) {
p->flags &= ~TERMP_KEEP;
p->flags |= TERMP_PREKEEP;
@@ -333,6 +336,16 @@ print_mdoc_node(DECL_ARGS)
}
}
+ /*
+ * Since SYNPRETTY sections aren't "turned off" with `Ek',
+ * we have to intuit whether we should disable formatting.
+ */
+
+ if ( ! (MDOC_SYNPRETTY & n->flags) &&
+ ((n->prev && MDOC_SYNPRETTY & n->prev->flags) ||
+ (n->parent && MDOC_SYNPRETTY & n->parent->flags)))
+ p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
+
if (chld && n->child)
print_mdoc_nodelist(p, &npair, m, n->child);