shithub: neatroff

Download patch

ref: f1c47cc83cecebd94020ed273ebe817f7153e69a
parent: ed5ff0386952cfeee3467f4d6a7ec50641a6e61f
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sun Sep 21 15:15:28 EDT 2014

ren: reset no-space mode after vertical movements due to .ne

Reported by Carsten Kunze <carsten.kunze@arcor.de>.

--- a/ren.c
+++ b/ren.c
@@ -144,6 +144,7 @@
 static void ren_sp(int n, int nodiv)
 {
 	ren_first();
+	n_ns = 0;
 	/* ignore .sp without arguments when reading diversions */
 	if (!n && ren_div && !n_u)
 		return;
@@ -315,9 +316,9 @@
 	sbuf_init(&send);
 	lspc = MAX(1, n_L) * n_v;	/* line space, ignoreing \x */
 	prev_d = n_d;
-	if (els_neg)
-		ren_sp(-els_neg, 1);
 	if (!n_ns || line[0] || els_neg || els_pos) {
+		if (els_neg)
+			ren_sp(-els_neg, 1);
 		ren_sp(0, 0);
 		if (line[0] && n_nm && body)
 			ren_lnum(&sbeg);
@@ -326,11 +327,11 @@
 			ren_mc(&send, w, ljust);
 		ren_out(sbuf_buf(&sbeg), line, sbuf_buf(&send));
 		n_ns = 0;
+		if (els_pos)
+			ren_sp(els_pos, 1);
 	}
 	sbuf_done(&sbeg);
 	sbuf_done(&send);
-	if (els_pos)
-		ren_sp(els_pos, 1);
 	n_a = els_pos;
 	if (detect_traps(prev_d, n_d) || detect_pagelimit(lspc - n_v)) {
 		if (!ren_pagelimit(lspc - n_v))