diff options
author | 2014-03-13 19:23:11 +0000 | |
---|---|---|
committer | 2014-03-13 19:23:11 +0000 | |
commit | 69e755eefbcaa9b0d2cea22f8fb5365a553a31d2 (patch) | |
tree | 2e89e639be26c7b32c57d3c11fe9d7c419f96382 | |
parent | Update the _OSI list to include newer Redmond products which may be requested (diff) | |
download | wireguard-openbsd-69e755eefbcaa9b0d2cea22f8fb5365a553a31d2.tar.xz wireguard-openbsd-69e755eefbcaa9b0d2cea22f8fb5365a553a31d2.zip |
In -Tutf8 mode, make sure that hyphens get counted against the output line
length even when they are breakable. Before this, a line containing N
breakable hyphens could get up to N characters wider than the right margin
in -Tutf8 output mode.
Issue reported by tedu@ on bugs@.
-rw-r--r-- | usr.bin/mandoc/term.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index be458c8e71e..cb803c31b04 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.77 2014/01/22 20:58:35 schwarze Exp $ */ +/* $Id: term.c,v 1.78 2014/03/13 19:23:11 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -179,6 +179,13 @@ term_flushln(struct termp *p) ASCII_BREAK == p->buf[j])) jhy = j; + /* + * Hyphenation now decided, put back a real + * hyphen such that we get the correct width. + */ + if (ASCII_HYPH == p->buf[j]) + p->buf[j] = '-'; + vend += (*p->width)(p, p->buf[j]); } @@ -244,12 +251,6 @@ term_flushln(struct termp *p) vbl = 0; } - if (ASCII_HYPH == p->buf[i]) { - (*p->letter)(p, '-'); - p->viscol += (*p->width)(p, '-'); - continue; - } - (*p->letter)(p, p->buf[i]); if (8 == p->buf[i]) p->viscol -= (*p->width)(p, p->buf[i-1]); |