diff options
| author | Neil <nyamatongwe@gmail.com> | 2019-05-17 09:02:10 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2019-05-17 09:02:10 +1000 |
| commit | e5f0fad791b6de839d1b62c8b0a1ac624b8a2025 (patch) | |
| tree | 4371a9102dc18673f86d6fb79e03ae2224554b71 | |
| parent | 61a2cc3fadea9f805f572ef2ce233c12b428b871 (diff) | |
| download | scintilla-mirror-e5f0fad791b6de839d1b62c8b0a1ac624b8a2025.tar.gz | |
Backport: Optimize InsertLines and DeleteLines for ContractionState if no folds contracted.
Backport of changeset 7500:c4db961b46ab.
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | src/ContractionState.cxx | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index c1e9f5fc9..d3eae6697 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -554,6 +554,10 @@ <a href="https://sourceforge.net/p/scintilla/feature-requests/1280/">Feature #1280</a>. </li> <li> + Improved performance of line folding code on large files when no folds are contracted. + This improves the time taken to open or close large files. + </li> + <li> Fix bug where changing identifier sets in lexers preserved previous identifiers. </li> <li> diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 47f345ada..ebbf9aefe 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -209,16 +209,24 @@ Sci::Line ContractionState<LINE>::DocFromDisplay(Sci::Line lineDisplay) const { template <typename LINE> void ContractionState<LINE>::InsertLines(Sci::Line lineDoc, Sci::Line lineCount) { - for (Sci::Line l = 0; l < lineCount; l++) { - InsertLine(lineDoc + l); + if (OneToOne()) { + linesInDocument += static_cast<LINE>(lineCount); + } else { + for (Sci::Line l = 0; l < lineCount; l++) { + InsertLine(lineDoc + l); + } } Check(); } template <typename LINE> void ContractionState<LINE>::DeleteLines(Sci::Line lineDoc, Sci::Line lineCount) { - for (Sci::Line l = 0; l < lineCount; l++) { - DeleteLine(lineDoc); + if (OneToOne()) { + linesInDocument -= static_cast<LINE>(lineCount); + } else { + for (Sci::Line l = 0; l < lineCount; l++) { + DeleteLine(lineDoc); + } } Check(); } |
