diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-03-13 19:23:50 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-03-13 19:23:50 +0000 |
commit | d8c40dbb7a90802c294a84afbbb0ecadbafae87b (patch) | |
tree | 214b1222a5d0b765cf14245de05ff257cf332b2c /term.c | |
parent | dc07642eedacb8edaeb34d51f9a4464efee267ee (diff) | |
download | mandoc-d8c40dbb7a90802c294a84afbbb0ecadbafae87b.tar.gz |
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 at OpenBSD>.
Diffstat (limited to 'term.c')
-rw-r--r-- | term.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -183,6 +183,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]); } @@ -248,12 +255,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]); |