summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-11-05 07:21:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-11-05 07:21:01 +0000
commitabe164b5b7d160faacfd0c626e28750e2bf31eef (patch)
treec4a6e4d85b36b11547ae335c113ee0d8021381f9
parentfa112dd09499ac23faf67420007920ff5b1a983e (diff)
downloadmandoc-abe164b5b7d160faacfd0c626e28750e2bf31eef.tar.gz
mandoc-abe164b5b7d160faacfd0c626e28750e2bf31eef.tar.zst
mandoc-abe164b5b7d160faacfd0c626e28750e2bf31eef.zip
Added functionality of -Tascii non-breaking `\~' space.
-rw-r--r--chars.c7
-rw-r--r--chars.in11
-rw-r--r--term.c9
3 files changed, 20 insertions, 7 deletions
diff --git a/chars.c b/chars.c
index 7ce4666d..580a1caf 100644
--- a/chars.c
+++ b/chars.c
@@ -1,4 +1,4 @@
-/* $Id: chars.c,v 1.12 2009/11/01 07:44:32 kristaps Exp $ */
+/* $Id: chars.c,v 1.13 2009/11/05 07:21:01 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -47,9 +47,10 @@ struct ln {
#define BOTH(w, x, y, z, a, b) \
{ NULL, (w), (y), (a), (x), (z), (b), CHARS_BOTH },
-static struct ln lines[LINES_MAX] = {
+#define CHAR_TBL_START static struct ln lines[LINES_MAX] = {
+#define CHAR_TBL_END };
+
#include "chars.in"
-};
struct tbl {
enum chars type;
diff --git a/chars.in b/chars.in
index 1e5d3048..c2ac4c16 100644
--- a/chars.in
+++ b/chars.in
@@ -1,4 +1,4 @@
-/* $Id: chars.in,v 1.18 2009/09/24 11:55:28 kristaps Exp $ */
+/* $Id: chars.in,v 1.19 2009/11/05 07:21:02 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -30,11 +30,16 @@
* XXX - update LINES_MAX if adding more!
*/
+/* Non-breaking, non-collapsing space uses unit separator. */
+static const char ascii_nbrsp[2] = { 31, 0 };
+
+CHAR_TBL_START
+
/* Spacing. */
CHAR("c", 1, "", 0, "", 0)
CHAR("0", 1, " ", 1, "&#8194;", 7)
CHAR(" ", 1, " ", 1, "&#8194;", 7)
-CHAR("~", 1, " ", 1, "&#160;", 6)
+CHAR("~", 1, ascii_nbrsp, 1, "&#160;", 6)
CHAR("%", 1, "", 0, "", 0)
CHAR("&", 1, "", 0, "", 0)
CHAR("^", 1, "", 0, "", 0)
@@ -416,3 +421,5 @@ CHAR("%0", 2, "%o", 2, "&#8240;", 7)
CHAR("fm", 2, "\'", 1, "&#8242;", 7)
CHAR("sd", 2, "\"", 1, "&#8243;", 7)
CHAR("mc", 2, "mu", 2, "&#181;", 6)
+
+CHAR_TBL_END
diff --git a/term.c b/term.c
index fd30d990..7afa1019 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.120 2009/10/31 06:10:58 kristaps Exp $ */
+/* $Id: term.c,v 1.121 2009/11/05 07:21:02 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -229,7 +229,12 @@ term_flushln(struct termp *p)
for ( ; i < (int)p->col; i++) {
if (' ' == p->buf[i])
break;
- putchar(p->buf[i]);
+
+ /* The unit sep. is a non-breaking space. */
+ if (31 == p->buf[i])
+ putchar(' ');
+ else
+ putchar(p->buf[i]);
}
vis += vsz;
}