diff options
-rw-r--r-- | chars.c | 7 | ||||
-rw-r--r-- | chars.in | 11 | ||||
-rw-r--r-- | term.c | 9 |
3 files changed, 20 insertions, 7 deletions
@@ -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; @@ -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, " ", 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 @@ -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; } |