hputchar: fix flag to reset hadnewline and improve comments - webdump - HTML to… | |
git clone git://git.codemadness.org/webdump | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 9f4c3a0a47eb2bb127db5a270dfa27ad368deb6a | |
parent a75a21256774e9ccda82f79ad7989f44bfa81e6a | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 11 Sep 2023 19:01:30 +0200 | |
hputchar: fix flag to reset hadnewline and improve comments | |
This flag is an extra safety, it can probably be removed. | |
Diffstat: | |
M webdump.c | 4 +++- | |
1 file changed, 3 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/webdump.c b/webdump.c | |
@@ -701,6 +701,7 @@ printansi(const char *s) | |
if (rbuflen + len + 1 < sizeof(rbuf)) { | |
memcpy(rbuf + rbuflen, s, len); | |
rbuflen += len; | |
+ /* NOTE: nbytesline and ncells are not counted for mar… | |
} | |
} else { | |
fputs(s, stdout); | |
@@ -791,7 +792,8 @@ hputchar(int c) | |
cur->hasdata = 1; | |
if (c == '\n') { | |
- if (nbytesline <= 0) | |
+ /* previous line had characters, so not a repeated newline */ | |
+ if (nbytesline > 0) | |
hadnewline = 0; | |
/* start a new line, no chars on this line yet */ |