shithub: neatroff

Download patch

ref: 046f8565a5a858c2201b4fcfef4daa65842d2b54
parent: c10361cc297cc032c392dba0f66482f8f53ef03b
author: Ali Gholami Rudi <[email protected]>
date: Wed Nov 28 16:28:16 EST 2012

tr: start a new page when passing \n(.p

--- a/ren.c
+++ b/ren.c
@@ -199,11 +199,19 @@
 	*s = '\0';
 }
 
+static void ren_ne(int n)
+{
+	if (n_nl + n > n_p)
+		ren_page(n_pg + 1);
+}
+
 static void down(int n)
 {
 	n_d += n;
 	n_nl = n_d;
-	printf("v%d\n", n);
+	if (n_nl <= n_p)
+		printf("v%d\n", n);
+	ren_ne(0);
 }
 
 static void ren_br(int sp, int adj)
@@ -212,9 +220,11 @@
 	buf[buflen] = '\0';
 	if (nwords) {
 		adjust(out, wid > LL ? n_ad : adj);
+		ren_ne(n_v);
 		down(n_v);
 		printf("H%d\n", n_o + n_i);
 		output(out);
+		ren_ne(n_v);
 	}
 	if (sp)
 		down(sp);
--- a/tr.c
+++ b/tr.c
@@ -84,6 +84,12 @@
 		n_v = tr_int(args[1], n_v, 'p');
 }
 
+static void tr_pl(char **args)
+{
+	if (args[1])
+		n_p = tr_int(args[1], n_p, 'v');
+}
+
 static void tr_ds(char **args)
 {
 	if (!args[2])
@@ -264,6 +270,7 @@
 	{"ll", tr_ll},
 	{"na", tr_na},
 	{"nr", tr_nr, mkargs_reg1},
+	{"pl", tr_pl},
 	{"ps", tr_ps},
 	{"sp", tr_sp},
 	{"vs", tr_vs},