mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
LibCore: IODevice::can_read_line() should succeed for newline-less file
If the first call to populate_read_buffer() hits EOF but something did get buffered, we can indeed read a line.
This commit is contained in:
parent
212aa85a55
commit
387607503c
1 changed files with 2 additions and 0 deletions
|
@ -130,6 +130,8 @@ bool IODevice::can_read_line() const
|
||||||
if (!can_read_from_fd())
|
if (!can_read_from_fd())
|
||||||
return false;
|
return false;
|
||||||
populate_read_buffer();
|
populate_read_buffer();
|
||||||
|
if (m_eof && !m_buffered_data.is_empty())
|
||||||
|
return true;
|
||||||
return m_buffered_data.contains_slow('\n');
|
return m_buffered_data.contains_slow('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue