1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

Spreadsheet: Make the XSV parser start with a preview parse

Instead of parsing the whole document. That's really wasteful and
super slow.
This commit is contained in:
Ali Mohammad Pur 2021-06-16 08:34:19 +04:30 committed by Ali Mohammad Pur
parent 88b168ff16
commit b11b3c2f1c
4 changed files with 36 additions and 7 deletions

View file

@ -147,7 +147,7 @@ auto CSVImportDialogPage::make_reader() -> Optional<Reader::XSV>
if (should_trim_trailing)
behaviours = behaviours | Reader::ParserBehaviour::TrimTrailingFieldSpaces;
return Reader::XSV(m_csv, traits, behaviours);
return Reader::XSV(m_csv, move(traits), behaviours);
};
void CSVImportDialogPage::update_preview()
@ -195,6 +195,7 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(String
NonnullRefPtrVector<Sheet> sheets;
if (reader.has_value()) {
reader->parse();
if (reader.value().has_error())
return String::formatted("CSV Import failed: {}", reader.value().error_string());