fix leading white-space in <pre> - webdump - HTML to plain-text converter for webpages (HTM) git clone git://git.codemadness.org/webdump (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 4d0ab293b3f3ecd2e5a491c8e94678811f03e398 (DIR) parent 1d80db038e35ca3778e2df19d00b9be512df185f (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Mon, 11 Sep 2023 18:58:55 +0200 fix leading white-space in <pre> Skip first newline only. Diffstat: M webdump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- (DIR) diff --git a/webdump.c b/webdump.c @@ -982,12 +982,12 @@ printpre(const char *s, size_t len) hadnewline = 0; currentnewlines = 0; - /* skip leading white-space */ + /* skip leading newline */ i = 0; if (skipinitialws) { - for (; *s && i < len; s++, i++) { - if (!ISSPACE((unsigned char)*s)) - break; + if (*s == '\n' && i < len) { + *s++; + i++; } }