shithub: neatroff

Download patch

ref: 30fddca2d52ece7c21aff95615e0f8410eed772a
parent: 314bec5278c282e1008f6dcd2ed31cb206644ee3
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Dec 5 14:16:03 EST 2014

draw: handle invalid line characters

--- a/draw.c
+++ b/draw.c
@@ -41,8 +41,8 @@
 		wb_hmov(wb, l);
 		l = -l;
 	}
-	n = l / w;
-	rem = l % w;
+	n = w ? l / w : 0;
+	rem = w ? l % w : l;
 	/* length less than character width */
 	if (l < w) {
 		n = 1;
@@ -76,8 +76,8 @@
 		wb_vmov(wb, l);
 		l = -l;
 	}
-	n = l / w;
-	rem = l % w;
+	n = w ? l / w : 0;
+	rem = w ? l % w : l;
 	/* length less than character width */
 	if (l < w) {
 		n = 1;