summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2013-12-25 00:39:15 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2013-12-25 00:39:15 +0000
commit0998a1ee6782b30d7fc056811c148549490bf797 (patch)
treefdbaa575d9ca98fcded6cd2d2132113790ef771d /usr.bin/mandoc/term.c
parent6e99e2673b8aa7d46827a967c8ad9f84b9d9d8aa (diff)
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 base by a fantastic 7.5%.
Diffstat (limited to 'usr.bin/mandoc/term.c')
-rw-r--r--usr.bin/mandoc/term.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index 0a6a2232877..795a3fdb167 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.74 2013/12/24 23:04:29 schwarze Exp $ */
+/* $Id: term.c,v 1.75 2013/12/25 00:39:13 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -403,6 +403,7 @@ term_fontpop(struct termp *p)
void
term_word(struct termp *p, const char *word)
{
+ const char nbrsp[2] = { ASCII_NBRSP, 0 };
const char *seq, *cp;
char c;
int sz, uc;
@@ -434,7 +435,15 @@ term_word(struct termp *p, const char *word)
word++;
continue;
}
- ssz = strcspn(word, "\\");
+ if (TERMP_NBRWORD & p->flags) {
+ if (' ' == *word) {
+ encode(p, nbrsp, 1);
+ word++;
+ continue;
+ }
+ ssz = strcspn(word, "\\ ");
+ } else
+ ssz = strcspn(word, "\\");
encode(p, word, ssz);
word += (int)ssz;
continue;
@@ -509,6 +518,7 @@ term_word(struct termp *p, const char *word)
break;
}
}
+ p->flags &= ~TERMP_NBRWORD;
}
static void