summaryrefslogtreecommitdiffstats
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
commit0c78894c64ebea8f4ab0917e43506b712921a05d (patch)
treeb7bb07cd90c4bde5dc23981dfc32d3c033c55929
parentf9109fa61e7b814ab140124e035d7e7f813e0995 (diff)
downloadmandoc-0c78894c64ebea8f4ab0917e43506b712921a05d.tar.gz
Added functionality of -Tascii non-breaking `\~' space.
-rw-r--r--chars.c5
-rw-r--r--chars.in9
-rw-r--r--term.c7
3 files changed, 17 insertions, 4 deletions
diff --git a/chars.c b/chars.c
index a7582d78..c297e610 100644
--- a/chars.c
+++ b/chars.c
@@ -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 282cb598..9162b090 100644
--- a/chars.in
+++ b/chars.in
@@ -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 5bd26040..de3f2326 100644
--- a/term.c
+++ b/term.c
@@ -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;
}