summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-27 21:52:16 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-27 21:52:16 +0000
commitbf244b038b727daea658caa6ef403eb2f0fb0e3e (patch)
tree3eda8805d591d3cb21d04af692d3e7d592508928
parent0f1b55634077afe1a36ef2cd8e8cb86c785ee52d (diff)
downloadmandoc-bf244b038b727daea658caa6ef403eb2f0fb0e3e.tar.gz
Even for UTF-8 output, a non-breaking space character has the same width
as a normal space character, and not width 0. Bug reported by bentley@.
-rw-r--r--term_ascii.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/term_ascii.c b/term_ascii.c
index b7712dc4..abc70f03 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -269,7 +269,12 @@ locale_width(const struct termp *p, int c)
{
int rc;
- return((rc = wcwidth(c)) < 0 ? 0 : rc);
+ if (c == ASCII_NBRSP)
+ c = ' ';
+ rc = wcwidth(c);
+ if (rc < 0)
+ rc = 0;
+ return(rc);
}
static void