shithub: neatroff

Download patch

ref: 7a335e6d95e877ab0c3a91e3efd9cabcc61e020b
parent: e5418ab62baa2d9c7e21e83cf2be34184e532ba4
author: Ali Gholami Rudi <[email protected]>
date: Thu Apr 3 20:35:49 EDT 2014

ren: end-of-sentence spacing when followed by font/size changes

The adj_nonl() command was added to prevent newlines for lines
containing only commands that do not print anything (like font or size
changes).  This patch makes sure render() does not call adj_nonl()
unnecessarily; otherwise, it may inhibit the insertion of a space
after end-of-sentence characters (when followed by a line break
starting with \f escape sequence).

--- a/ren.c
+++ b/ren.c
@@ -951,6 +951,9 @@
 			adj_swid(cadj, spacewid(n_f, n_s));
 			if (!wb_part(wb)) {	/* not after a \c */
 				adj_wb(cadj, wb);
+				/* wb contains only commands like \f */
+				if (!ren_nl && wb_empty(wb))
+					adj_nonl(cadj);
 				if (c == '\n')
 					adj_nl(cadj);
 				else
@@ -974,8 +977,6 @@
 		if (c != ' ') {
 			ren_back(c);
 			ren_char(wb, ren_next, ren_back);
-			if (c != '\n' && wb_empty(wb))
-				adj_nonl(cadj);
 		}
 		ren_nl = c == '\n';
 		c = ren_next();