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:
Andreas Kling 2020-10-25 13:34:52 +01:00
parent 212aa85a55
commit 387607503c
Notes: sideshowbarker 2024-07-19 01:44:32 +09:00

View file

@ -130,6 +130,8 @@ bool IODevice::can_read_line() const
if (!can_read_from_fd())
return false;
populate_read_buffer();
if (m_eof && !m_buffered_data.is_empty())
return true;
return m_buffered_data.contains_slow('\n');
}