shithub: neatroff

Download patch

ref: 6916b6ec34104898f179ef05ac0e194574d738e9
parent: 8a095062fb0581494c9ded643663bebeb898de7c
author: Ali Gholami Rudi <ali@rudi.ir>
date: Mon Sep 1 14:37:40 EDT 2014

ren: ".ch xx" should remove the trap

--- a/ren.c
+++ b/ren.c
@@ -1060,7 +1060,7 @@
 		return;
 	}
 	reg = map(args[2]);
-	if (id < 0)
+	if (id < 0)		/* find an unused position in treg[] */
 		id = trap_byreg(-1);
 	if (id < 0)
 		id = ntraps++;
@@ -1076,8 +1076,12 @@
 		return;
 	reg = map(args[1]);
 	id = trap_byreg(reg);
-	if (id >= 0)
-		tpos[id] = args[2] ? eval(args[2], 'v') : -1;
+	if (id >= 0) {
+		if (args[2])
+			tpos[id] = eval(args[2], 'v');
+		else
+			treg[id] = -1;
+	}
 }
 
 void tr_dt(char **args)