Skip to content

Conversation

@WhoBrokeTheBuild
Copy link
Member

When a file does not end with a newline, READ() erroneously strips off the last character of the last line.
This simply checks that it is a newline before removing it.

example.txt

This line has a newline
This line doesn't
_file = fopen('example.txt', 'r')
read(_file) # "This line has a newline"
read(_file) # "This line doesn't"

Previously, the last read() would have returned "This line doesn'"

@WhoBrokeTheBuild WhoBrokeTheBuild self-assigned this Dec 9, 2025
@WhoBrokeTheBuild WhoBrokeTheBuild added bug An unexpected problem or unintended behavior tool/tdi Relates to the TDI language or prompts (tditest, tdic) labels Dec 9, 2025
When a file does not end with a newline, READ() erroneously strips off the last character of the last line. This simply checks that it is a newline before removing it.
@WhoBrokeTheBuild WhoBrokeTheBuild force-pushed the slw-fix-tdi-read-last-line branch from e35bf6c to cef1bc5 Compare January 13, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An unexpected problem or unintended behavior tool/tdi Relates to the TDI language or prompts (tditest, tdic)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants