source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: In -Tutf8 mode, make sure that hyphens get counted against the
@ 2014-03-13 19:23 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-03-13 19:23 UTC (permalink / raw)
  To: source

Log Message:
-----------
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>.

Modified Files:
--------------
    mdocml:
        term.c

Revision Data
-------------
Index: term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v
retrieving revision 1.216
retrieving revision 1.217
diff -Lterm.c -Lterm.c -u -p -r1.216 -r1.217
--- term.c
+++ term.c
@@ -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]);
 		}
 
@@ -246,12 +253,6 @@ term_flushln(struct termp *p)
 				(*p->advance)(p, vbl);
 				p->viscol += vbl;
 				vbl = 0;
-			}
-
-			if (ASCII_HYPH == p->buf[i]) {
-				(*p->letter)(p, '-');
-				p->viscol += (*p->width)(p, '-');
-				continue;
 			}
 
 			(*p->letter)(p, p->buf[i]);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-13 19:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13 19:23 mdocml: In -Tutf8 mode, make sure that hyphens get counted against the schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).