diff options
author | Zufu Liu <unknown> | 2022-07-24 10:00:06 +1000 |
---|---|---|
committer | Zufu Liu <unknown> | 2022-07-24 10:00:06 +1000 |
commit | 2a922d679ec36743287191fbd9f67a6fef9f7f1b (patch) | |
tree | b5743e169339ff691913b9fd0a5d59455db73498 /src/Editor.cxx | |
parent | 46e54d394dfd76a0d3055850ce8e6f394dfe2ba7 (diff) | |
download | scintilla-mirror-2a922d679ec36743287191fbd9f67a6fef9f7f1b.tar.gz |
Bug [#2340] Simplify expand all folds. Speed up expand line a little.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 5b0486be0..a4e2cc732 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5414,18 +5414,23 @@ void Editor::SetEOLAnnotationVisible(EOLAnnotationVisible visible) { Sci::Line Editor::ExpandLine(Sci::Line line) { const Sci::Line lineMaxSubord = pdoc->GetLastChild(line); line++; + Sci::Line lineStart = line; while (line <= lineMaxSubord) { - pcs->SetVisible(line, line, true); const FoldLevel level = pdoc->GetFoldLevel(line); if (LevelIsHeader(level)) { + pcs->SetVisible(lineStart, line, true); if (pcs->GetExpanded(line)) { line = ExpandLine(line); } else { line = pdoc->GetLastChild(line); } + lineStart = line + 1; } line++; } + if (lineStart <= lineMaxSubord) { + pcs->SetVisible(lineStart, lineMaxSubord, true); + } return lineMaxSubord; } @@ -5588,11 +5593,7 @@ void Editor::FoldAll(FoldAction action) { } if (expanding) { pcs->SetVisible(0, maxLine-1, true); - for (Sci::Line line = 0; line < maxLine; line++) { - if (!pcs->GetExpanded(line)) { - SetFoldExpanded(line, true); - } - } + pcs->ExpandAll(); } else { for (Sci::Line line = 0; line < maxLine; line++) { const FoldLevel level = pdoc->GetFoldLevel(line); |