shithub: neatroff

Download patch

ref: 45c18fa7176a70388ed25465a339b60b7e50bab0
parent: 819f4ebfd4fd33e20815761664f8c3e1c34bada8
author: Ali Gholami Rudi <[email protected]>
date: Mon Jul 8 18:32:27 EDT 2013

wb: ignore requests in diverted text

--- a/out.c
+++ b/out.c
@@ -216,11 +216,11 @@
 	char c[ILNLEN + GNLEN * 4];
 	int t;
 	while ((t = out_readc(&s, c)) >= 0) {
-		if (c[0] == c_ni) {
-			c[0] = c[1];
-			c[1] = '\0';
-		}
 		if (!t) {
+			if (c[0] == c_ni || (c[0] == '\\' && c[1] == '\\')) {
+				c[0] = c[1];
+				c[1] = '\0';
+			}
 			if (c[0] == '\t' || c[0] == '' || !strcmp(c_hc, c))
 				continue;
 			g = dev_glyph(c, o_f);
--- a/ren.c
+++ b/ren.c
@@ -651,6 +651,8 @@
 		ren_field(wb, next, back);
 		return;
 	}
+	if (c[0] == c_ni)
+		nextchar(c + 1, next);
 	if (c[0] == c_ec) {
 		nextchar(c + 1, next);
 		if (c[1] == '(') {
@@ -691,8 +693,6 @@
 			strcpy(c, arg);
 		}
 	}
-	if (c[0] == c_ni)
-		nextchar(c + 1, next);
 	if (!n_lg || wb_lig(wb, c)) {
 		if (n_kn)
 			wb_kern(wb, c);
--- a/wb.c
+++ b/wb.c
@@ -96,7 +96,10 @@
 	wb_font(wb);
 	if (!c[1] || c[0] == c_ec || c[0] == c_ni ||
 			utf8len((unsigned char) c[0]) == strlen(c)) {
-		sbuf_append(&wb->sbuf, c);
+		if (c[0] == c_ni && c[1] == c_ec)
+			sbuf_printf(&wb->sbuf, "%c%c", c_ec, c_ec);
+		else
+			sbuf_append(&wb->sbuf, c);
 	} else {
 		if (c[1] && !c[2])
 			sbuf_printf(&wb->sbuf, "%c(%s", c_ec, c);