diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-11-05 07:21:01 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-11-05 07:21:01 +0000 |
commit | 0c78894c64ebea8f4ab0917e43506b712921a05d (patch) | |
tree | b7bb07cd90c4bde5dc23981dfc32d3c033c55929 | |
parent | f9109fa61e7b814ab140124e035d7e7f813e0995 (diff) | |
download | mandoc-0c78894c64ebea8f4ab0917e43506b712921a05d.tar.gz |
Added functionality of -Tascii non-breaking `\~' space.
-rw-r--r-- | chars.c | 5 | ||||
-rw-r--r-- | chars.in | 9 | ||||
-rw-r--r-- | term.c | 7 |
3 files changed, 17 insertions, 4 deletions
@@ -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; @@ -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, " ", 7) CHAR(" ", 1, " ", 1, " ", 7) -CHAR("~", 1, " ", 1, " ", 6) +CHAR("~", 1, ascii_nbrsp, 1, " ", 6) CHAR("%", 1, "", 0, "", 0) CHAR("&", 1, "", 0, "", 0) CHAR("^", 1, "", 0, "", 0) @@ -416,3 +421,5 @@ CHAR("%0", 2, "%o", 2, "‰", 7) CHAR("fm", 2, "\'", 1, "′", 7) CHAR("sd", 2, "\"", 1, "″", 7) CHAR("mc", 2, "mu", 2, "µ", 6) + +CHAR_TBL_END @@ -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; } |