shithub: neatroff

Download patch

ref: 3dd4fdbf2e959b9916dfeba63453bdf1c1fa3afb
parent: 15cb691f34b7263ef7a9f5d81010ff1280a7f507
author: Ali Gholami Rudi <ali@rudi.ir>
date: Thu May 2 07:19:15 EDT 2013

ren: \n(.t is the distance to the next trap from the current position

--- a/ren.c
+++ b/ren.c
@@ -655,10 +655,10 @@
 	struct wb *wb = &ren_wb;
 	int c;
 	n_nl = -1;
+	wb_init(wb);
 	tr_first();
 	ren_first();			/* transition to the first page */
 	c = ren_next();
-	wb_init(wb);
 	while (c >= 0) {
 		if (c == ' ' || c == '\n') {
 			adj_swid(cadj, charwid(dev_spacewid(), n_s));
@@ -683,6 +683,7 @@
 		c = ren_next();
 	}
 	ren_br(1);
+	wb_done(wb);
 }
 
 /* trap handling */
@@ -793,5 +794,5 @@
 	int pos = trap_pos(n_d);
 	if (cdiv)
 		return pos >= 0 ? pos : 0x7fffffff;
-	return pos >= 0 && pos < n_p ? pos : n_p - n_d;
+	return (pos >= 0 && pos < n_p ? pos : n_p) - n_d;
 }