do not reset ncells or nbytesline if no newline was emitted - webdump - HTML to plain-text converter for webpages
HTML git clone git://git.codemadness.org/webdump
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 790402682bab675461f2a12879408dd5ad30c90f
DIR parent 8d29c76012b91bbfaad1feca31b2af4cfbc99032
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 12 Sep 2023 20:01:15 +0200
do not reset ncells or nbytesline if no newline was emitted
Test-case:
<div>
<div><b></b></div>
<p>abc</p>
</div>
This caused an extra indentation due to the nbytesline check in hflush().
Diffstat:
M webdump.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
DIR diff --git a/webdump.c b/webdump.c
@@ -1571,10 +1571,10 @@ handleendtag(struct tag *tag)
hflush();
for (i = currentnewlines; i < marginbottom; i++) {
putchar('\n');
+ nbytesline = 0;
+ ncells = 0;
currentnewlines++;
}
- nbytesline = 0;
- ncells = 0;
hadnewline = 1;
}
}
@@ -1933,10 +1933,10 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort)
hflush();
for (i = currentnewlines; i < margintop; i++) {
putchar('\n');
+ nbytesline = 0;
+ ncells = 0;
currentnewlines++;
}
- nbytesline = 0;
- ncells = 0;
hadnewline = 1;
}