aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term_ascii.c
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
commit8eb68fb06ce6113d20d01d458aac0daec7b2419f (patch)
treefa0e54b62bb5e6d8ac365735e1c6f84a276ddd02 /term_ascii.c
parent8b17a548dd118d115762ef272ab9eb59b2f5119b (diff)
downloadmandoc-8eb68fb06ce6113d20d01d458aac0daec7b2419f.tar.gz
mandoc-8eb68fb06ce6113d20d01d458aac0daec7b2419f.tar.zst
mandoc-8eb68fb06ce6113d20d01d458aac0daec7b2419f.zip
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@.
Diffstat (limited to 'term_ascii.c')
-rw-r--r--term_ascii.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/term_ascii.c b/term_ascii.c
index a2ab4839..adcbe590 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.25 2014/04/20 16:46:05 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.26 2014/07/27 21:52:16 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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