1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 01:34:58 +00:00

LibGUI: Don't recompute line-wrapping over and over during set_text()

This makes the TextEditor start up fast for large files again.
This commit is contained in:
Andreas Kling 2019-11-23 17:41:14 +01:00
parent 9a157b5e81
commit fc14bdd442
4 changed files with 36 additions and 16 deletions

View file

@ -1613,6 +1613,14 @@ void GTextEditor::document_did_change()
update();
}
void GTextEditor::document_did_set_text()
{
m_line_visual_data.clear();
for (int i = 0; i < m_document->line_count(); ++i)
m_line_visual_data.append(make<LineVisualData>());
document_did_change();
}
void GTextEditor::set_document(GTextDocument& document)
{
if (m_document.ptr() == &document)