mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 02:38:59 +00:00
Spreadsheet: Ignore extra empty lines after the rows
We now ignore the last CRLF in e.g. ```csv aaa,bbb,ccc CRLF zzz,yyy,xxx CRLF ```
This commit is contained in:
parent
894bfa30a2
commit
ccf84a4709
Notes:
sideshowbarker
2024-07-18 21:00:06 +09:00
Author: https://github.com/alimpfard
Commit: ccf84a4709
Pull-request: https://github.com/SerenityOS/serenity/pull/5945
Issue: https://github.com/SerenityOS/serenity/issues/5942
1 changed files with 6 additions and 0 deletions
|
@ -71,6 +71,12 @@ void XSV::parse()
|
||||||
while (!has_error() && !m_lexer.is_eof())
|
while (!has_error() && !m_lexer.is_eof())
|
||||||
m_rows.append(read_row());
|
m_rows.append(read_row());
|
||||||
|
|
||||||
|
// Read and drop any extra lines at the end.
|
||||||
|
while (!m_lexer.is_eof()) {
|
||||||
|
if (!m_lexer.consume_specific("\r\n") && !m_lexer.consume_specific('\n'))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_lexer.is_eof())
|
if (!m_lexer.is_eof())
|
||||||
set_error(ReadError::DataPastLogicalEnd);
|
set_error(ReadError::DataPastLogicalEnd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue