From f82a2c25a5805d0dab5cd66ef221eb247bc36134 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 10 May 2022 12:19:52 +1000 Subject: Improve performance of SCI_FOLDALL(SC_FOLDACTION_EXPAND). --- doc/ScintillaHistory.html | 4 ++++ src/Editor.cxx | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index b7d4b1e5b..066e18af0 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -581,6 +581,10 @@ Released 31 March 2022.
  • + Improve performance of SCI_FOLDALL(SC_FOLDACTION_EXPAND) by not lexing whole document + as it does not depend on folding structure. +
  • +
  • Fix partial updates and non-responsive scroll bars on Xorg. This defers scroll bar changes to an idle task so could affect applications that depend on the scroll position being updated. diff --git a/src/Editor.cxx b/src/Editor.cxx index 6ff0f2d97..387194fe3 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5529,9 +5529,11 @@ void Editor::EnsureLineVisible(Sci::Line lineDoc, bool enforcePolicy) { } void Editor::FoldAll(FoldAction action) { - pdoc->EnsureStyledTo(pdoc->Length()); const Sci::Line maxLine = pdoc->LinesTotal(); bool expanding = action == FoldAction::Expand; + if (!expanding) { + pdoc->EnsureStyledTo(pdoc->Length()); + } if (action == FoldAction::Toggle) { // Discover current state for (int lineSeek = 0; lineSeek < maxLine; lineSeek++) { @@ -5544,8 +5546,7 @@ void Editor::FoldAll(FoldAction action) { if (expanding) { pcs->SetVisible(0, maxLine-1, true); for (int line = 0; line < maxLine; line++) { - const FoldLevel levelLine = pdoc->GetFoldLevel(line); - if (LevelIsHeader(levelLine)) { + if (!pcs->GetExpanded(line)) { SetFoldExpanded(line, true); } } -- cgit v1.2.3