Skip to content

Skip a lone CR in readLine() instead of grabbing the next byte - #236

Merged
MikeMirzayanov merged 1 commit into
masterfrom
fix-readline-cr-eof
Nov 3, 2026
Merged

MikeMirzayanov merged 1 commit into
masterfrom
fix-readline-cr-eof

Conversation

@MikeMirzayanov

Copy link
Copy Markdown
Owner

After a CR that is not followed by LF, readStringTo() appended the following character without looking at it. At the end of the file that character was EOFC, so readLine()/readString() on "abc\r" returned "abc\xFF". Re-check the current character instead: LF and CRLF end the line, a lone CR is skipped, EOF ends the line with no extra byte.

Add tests/test-010_read-line-cr covering string and file streams. Bump version to 0.9.49.

After a CR that is not followed by LF, readStringTo() appended the
following character without looking at it. At the end of the file
that character was EOFC, so readLine()/readString() on "abc\r" returned
"abc\xFF". Re-check the current character instead: LF and CRLF end
the line, a lone CR is skipped, EOF ends the line with no extra byte.

Add tests/test-010_read-line-cr covering string and file streams.
Bump version to 0.9.49.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@MikeMirzayanov
MikeMirzayanov merged commit 125ca84 into master Nov 3, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant