summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-17 02:14:02 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-17 02:14:02 -0700
commit6c6e85a516f668ff35a9370cafdceceb10bf93d7 (patch)
tree2e240f929e744031e1b8bb068b87a0e95e68c295
parentac186529b6b5f80906c3215a67c98505db7bb156 (diff)
downloadman-6c6e85a516f668ff35a9370cafdceceb10bf93d7.tar.gz
man-6c6e85a516f668ff35a9370cafdceceb10bf93d7.tar.bz2
man-6c6e85a516f668ff35a9370cafdceceb10bf93d7.zip
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.
-rw-r--r--man2html/man2html.c9
1 files 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':
{