From 50aba90c460f529396e34797ccd6363e0f246c9c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 25 Dec 2013 00:39:31 +0000 Subject: 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%. --- mdoc_man.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'mdoc_man.c') diff --git a/mdoc_man.c b/mdoc_man.c index d5e1f457..530461d3 100644 --- a/mdoc_man.c +++ b/mdoc_man.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_man.c,v 1.55 2013/12/24 22:08:50 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.56 2013/12/25 00:39:31 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013 Ingo Schwarze * @@ -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)) -- cgit v1.2.3-56-ge451