summaryrefslogtreecommitdiffstats
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2013-12-25 00:39:31 +0000
committerIngo Schwarze <schwarze@openbsd.org>2013-12-25 00:39:31 +0000
commitae3f51d742a1c36dd2092d91c57e3885d28a21f5 (patch)
tree743265550f2e5411f8f89f8d493d55658fe50acc /mdoc_man.c
parent4502d03c03ab81e38efc29a83958d57f9d2a3a36 (diff)
downloadmandoc-ae3f51d742a1c36dd2092d91c57e3885d28a21f5.tar.gz
Do not break output lines in .Fn function arguments in SYNOPSIS mode.
Following an idea from Franco Fichtner, but implemented more cleanly. This reduces groff-mandoc-differences in OpenBSD base by a fantastic 7.5%.
Diffstat (limited to 'mdoc_man.c')
-rw-r--r--mdoc_man.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index 8ea1e166..d21cad56 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -256,6 +256,7 @@ static int outflags;
#define MMAN_An_split (1 << 9) /* author mode is "split" */
#define MMAN_An_nosplit (1 << 10) /* author mode is "nosplit" */
#define MMAN_PD (1 << 11) /* inter-paragraph spacing disabled */
+#define MMAN_nbrword (1 << 12) /* do not break the next word */
#define BL_STACK_MAX 32
@@ -364,6 +365,12 @@ print_word(const char *s)
case (ASCII_HYPH):
putchar('-');
break;
+ case (' '):
+ if (MMAN_nbrword & outflags) {
+ printf("\\ ");
+ break;
+ }
+ /* FALLTHROUGH */
default:
putchar((unsigned char)*s);
break;
@@ -371,6 +378,7 @@ print_word(const char *s)
if (TPremain)
TPremain--;
}
+ outflags &= ~MMAN_nbrword;
}
static void
@@ -1028,6 +1036,8 @@ pre_fa(DECL_ARGS)
while (NULL != n) {
font_push('I');
+ if (MDOC_SYNPRETTY & n->flags)
+ outflags |= MMAN_nbrword;
print_node(meta, n);
font_pop();
if (NULL != (n = n->next))