shithub: neatroff

Download patch

ref: 0ab9d55cd241a2d311b265c841031156278cb930
parent: c7c03b58d38c1be91e1bee9f3cb22eddee3a46aa
author: Ali Gholami Rudi <ali@rudi.ir>
date: Thu Apr 18 12:57:59 EDT 2013

ren: add .ls and \n(.L

--- a/reg.c
+++ b/reg.c
@@ -25,6 +25,7 @@
 	REG('.', 'i'),
 	REG('.', 'j'),
 	REG('.', 'l'),
+	REG('.', 'L'),
 	REG('.', 's'),
 	REG('.', 'u'),
 	REG('.', 'v'),
@@ -31,6 +32,7 @@
 	REG(0, 'f'),
 	REG(0, 'i'),
 	REG(0, 'l'),
+	REG(0, 'L'),
 	REG(0, 'n'),
 	REG(0, 's'),
 	REG(0, 'v'),
--- a/ren.c
+++ b/ren.c
@@ -248,9 +248,13 @@
 		}
 		if (els_pos)
 			ren_sp(els_pos);
-		if (!ren_traps(prev_d, n_d, 0))
-			ren_pagelimit(0);
 		n_a = els_pos;
+		if (!ren_traps(prev_d, n_d, 0)) {
+			if (n_L > n_v && (cdiv || n_d < n_p))
+				down(n_L - n_v);
+			else
+				ren_pagelimit(0);
+		}
 	}
 }
 
--- a/tr.c
+++ b/tr.c
@@ -21,6 +21,13 @@
 	n_v = vs;
 }
 
+static void tr_ls(char **args)
+{
+	int ls = args[1] ? eval(args[1], n_L, 'v') : n_L0;
+	n_L0 = n_L;
+	n_L = ls;
+}
+
 static void tr_pl(char **args)
 {
 	if (args[1])
@@ -469,6 +476,7 @@
 	{"ig", tr_ig},
 	{"in", tr_in},
 	{"ll", tr_ll},
+	{"ls", tr_ls},
 	{"mk", tr_mk},
 	{"na", tr_na},
 	{"ne", tr_ne},
--- a/xroff.h
+++ b/xroff.h
@@ -197,6 +197,7 @@
 #define n_i		(*nreg(REG('.', 'i')))
 #define n_j		(*nreg(REG('.', 'j')))
 #define n_l		(*nreg(REG('.', 'l')))
+#define n_L		(*nreg(REG('.', 'L')))
 #define n_n		(*nreg(REG('.', 'n')))
 #define n_o		(*nreg(REG('.', 'o')))
 #define n_p		(*nreg(REG('.', 'p')))
@@ -212,6 +213,7 @@
 #define n_f0		(*nreg(REG(0, 'f')))	/* last .f */
 #define n_i0		(*nreg(REG(0, 'i')))	/* last .i */
 #define n_l0		(*nreg(REG(0, 'l')))	/* last .l */
+#define n_L0		(*nreg(REG(0, 'L')))	/* last .L */
 #define n_mk		(*nreg(REG(0, 'm')))	/* .mk internal register */
 #define n_na		(*nreg(REG(0, 'n')))	/* .na mode */
 #define n_ns		(*nreg(REG(0, 'N')))	/* .ns mode */