From 6c6e85a516f668ff35a9370cafdceceb10bf93d7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 17 May 2021 02:14:02 -0700 Subject: Actually fix bug handling escape at end of a line. The previous fix to this is incorrect. In the TXR man page, cases of \*(TL at the end of a line are still run together with the following material. To set the escnl flag, we must not be looking at the HTML output before the escape. That is not relevant. What we need to know is whether the HTML output *of* the escape ends in whitespace. If the output does not end in whitespace, and the escape is at the end of a source line, then we set the escnl flag. The output of scan_scape is not going into intbuff; intbuff is a local buffer in do_scan_troff. We must peek into the global outbuffer. Also, escnl needs to be cleared when processed. --- man2html/man2html.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/man2html/man2html.c b/man2html/man2html.c index 3a06408..6c8799d 100644 --- a/man2html/man2html.c +++ b/man2html/man2html.c @@ -3048,12 +3048,12 @@ do_scan_troff(char *c, int san, int htmlesc, char **result) { /* san : stop at n while (*h && (!san || newline_for_fun || *h != '\n')) { if (*h == escapesym) { h++; - if ((ibp > 0 && !isspace(intbuff[ibp-1])) || !fillout) - escnl = 1; FLUSHIBP; h = scan_escape(h); - if (*h != '\n') - escnl = 0; + outbuffer[obp] = 0; + if (*h == '\n' && + ((obp > 0 && !isspace(outbuffer[obp-1])) || !fillout)) + escnl = 1; } else if (*h == '\b') { intbuff[ibp++]=*h++; if (ibp>480) { FLUSHIBP; } @@ -3137,6 +3137,7 @@ do_scan_troff(char *c, int san, int htmlesc, char **result) { /* san : stop at n h++; } } + escnl = 0; break; case '\t': { -- cgit v1.2.3