aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.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
commit50aba90c460f529396e34797ccd6363e0f246c9c (patch)
tree349f08a9fffc24cd8092cc06d4f4804b22ff50a1 /term.c
parent319dd615ecf9bfbb4f80d4a40c14cfa67f905b04 (diff)
downloadmandoc-50aba90c460f529396e34797ccd6363e0f246c9c.tar.gz
mandoc-50aba90c460f529396e34797ccd6363e0f246c9c.tar.zst
mandoc-50aba90c460f529396e34797ccd6363e0f246c9c.zip
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 'term.c')
-rw-r--r--term.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/term.c b/term.c
index 2321aaac..e7b95578 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.213 2013/12/24 23:04:36 schwarze Exp $ */
+/* $Id: term.c,v 1.214 2013/12/25 00:39:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -407,6 +407,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;
@@ -438,7 +439,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;
@@ -513,6 +522,7 @@ term_word(struct termp *p, const char *word)
break;
}
}
+ p->flags &= ~TERMP_NBRWORD;
}
static void