aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2022-05-10 12:19:52 +1000
committerNeil <nyamatongwe@gmail.com>2022-05-10 12:19:52 +1000
commitf82a2c25a5805d0dab5cd66ef221eb247bc36134 (patch)
tree8012b8437d7e503626ac06b62fb3f6a9c475df92
parent4e556e4aaba49f4307ab4933a376e0c34d0be674 (diff)
downloadscintilla-mirror-f82a2c25a5805d0dab5cd66ef221eb247bc36134.tar.gz
Improve performance of SCI_FOLDALL(SC_FOLDACTION_EXPAND).
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--src/Editor.cxx7
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.
</li>
<li>
+ Improve performance of SCI_FOLDALL(SC_FOLDACTION_EXPAND) by not lexing whole document
+ as it does not depend on folding structure.
+ </li>
+ <li>
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);
}
}