mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
5a8373c6b9
When BufferedFile.can_read_line() was invoked on files with no newlines, t incorrectly returned a false result for this single line that, even though doesn't finish with a newline character, is still a line. Since this method is usually used in tandem with read_line(), users would miss reading this line (and hence all the file contents). This commit fixes this corner case by adding another check after a negative result from finding a newline character. This new check does the same as the check that is done *before* looking for newlines, which takes care of this problem, but only works for files that have at least one newline (hence the buffer has already been filled). A new unit test has been added that shows the use case. Without the changes in this commit the test fails, which is a testament that this commit really fixes the underlying issue. |
||
---|---|---|
.. | ||
10kb.txt | ||
CMakeLists.txt | ||
long_lines.txt | ||
small.txt | ||
TestLibCoreArgsParser.cpp | ||
TestLibCoreDeferredInvoke.cpp | ||
TestLibCoreFilePermissionsMask.cpp | ||
TestLibCoreFileWatcher.cpp | ||
TestLibCoreIODevice.cpp | ||
TestLibCoreSharedSingleProducerCircularQueue.cpp | ||
TestLibCoreStream.cpp |