shithub: neatroff

Download patch

ref: 89196863d2d2767978d626f56646d00740bdd2bc
parent: 571b5fbddff6b434589db79ab6ae5df40033b925
author: Ali Gholami Rudi <[email protected]>
date: Sat Aug 17 18:59:32 EDT 2013

wb: for hyphenation compare dp and hp only when both are non-NULL

This is only necessary for the case "flg & HY_ANY"; i.e. when
hyphenating a line with a single word.

--- a/wb.c
+++ b/wb.c
@@ -457,7 +457,10 @@
 		return 1;
 	dp = dashpos(sbuf_buf(&wb->sbuf), w, w1, flg & HY_ANY);
 	hp = indicatorpos(sbuf_buf(&wb->sbuf), w, w1, flg & HY_ANY);
-	p = flg & HY_ANY ? MIN(dp, hp) : MAX(dp, hp);
+	if (hp && dp)
+		p = flg & HY_ANY ? MIN(dp, hp) : MAX(dp, hp);
+	else
+		p = dp ? dp : hp;
 	if (!p && flg & HY_MASK)
 		p = hyphpos(sbuf_buf(&wb->sbuf), w, w1, flg & HY_ANY);
 	if (p)