From: schwarze Date: Sun, 27 Jul 2014 21:51:53 +0000 (+0000) Subject: Even for UTF-8 output, a non-breaking space character has the same width X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c9fd5525afe895cc6659985d40b19ea88e9f8b81;p=openbsd 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@. --- diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c index 44d16ef593b..064e12e0691 100644 --- a/usr.bin/mandoc/term_ascii.c +++ b/usr.bin/mandoc/term_ascii.c @@ -1,4 +1,4 @@ -/* $Id: term_ascii.c,v 1.14 2014/04/20 16:44:44 schwarze Exp $ */ +/* $Id: term_ascii.c,v 1.15 2014/07/27 21:51:53 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -245,7 +245,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