shithub: neatroff

Download patch

ref: 4e99f4ced5a4380fcc86510026cbfb1a0c65f3de
parent: 860466c3d6b463f1a149463c31aeeb96543f6bd2
author: Ali Gholami Rudi <[email protected]>
date: Sun Sep 28 20:02:37 EDT 2014

ren: handle explicit vertical spacing in diversions once more

This was introduced when adding tr_divvs() request to save line
spacing inside diversions.

--- a/ren.c
+++ b/ren.c
@@ -156,6 +156,7 @@
 /* when nodiv, do not append .sp to diversions */
 static void ren_sp(int n, int nodiv)
 {
+	int linevs = !n;	/* the vertical spacing before a line */
 	ren_first();
 	if (!n && ren_div && ren_divvs && !n_u)
 		n = ren_divvs;	/* .v at the time of diversion */
@@ -164,8 +165,12 @@
 	n_d += n ? n : n_v;
 	if (n_d > n_h)
 		n_h = n_d;
-	if (cdiv && !nodiv)
-		sbuf_printf(&cdiv->sbuf, "%c%s %du\n", c_cc, TR_DIVVS, n_v);
+	if (cdiv && !nodiv) {
+		if (linevs)
+			sbuf_printf(&cdiv->sbuf, "%c%s %du\n", c_cc, TR_DIVVS, n_v);
+		else
+			sbuf_printf(&cdiv->sbuf, "%csp %du\n", c_cc, n ? n : n_v);
+	}
 	if (!cdiv)
 		n_nl = n_d;
 }