remove multiple trailing newline characters from •GetLine

Windows adds \r\n, and without this the \r stays
This commit is contained in:
dzaima 2023-08-04 20:52:07 +03:00
parent 8e35241e47
commit a1e4f9bd6f

View File

@ -931,7 +931,9 @@ B getLine_c1(B t, B x) {
if (ln) free(ln); if (ln) free(ln);
return m_c32(0); return m_c32(0);
} }
B r = utf8Decode(ln, strlen(ln)-1); u64 len = strlen(ln);
while (len && (ln[len-1]=='\r' || ln[len-1]=='\n')) len--;
B r = utf8Decode(ln, len);
free(ln); free(ln);
return r; return r;
} }