aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-12-23 01:02:34 +0000
committernyamatongwe <unknown>2001-12-23 01:02:34 +0000
commita8af8d9c4f76eb50cec4bd877787d6b04d5a821f (patch)
tree1c1277c7c225a5490060c31013dc4de7f9a34f99
parent10fae6511e06f1cfe9771e54272fa8c97c8dd299 (diff)
downloadscintilla-mirror-a8af8d9c4f76eb50cec4bd877787d6b04d5a821f.tar.gz
Optimisation that avoids creating the lines and docLines arrays unless
needed because a line has been folded or has a height greater than 1.
-rw-r--r--src/ContractionState.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx
index 362dc1ed8..3d2dde3c6 100644
--- a/src/ContractionState.cxx
+++ b/src/ContractionState.cxx
@@ -225,6 +225,11 @@ bool ContractionState::GetExpanded(int lineDoc) const {
bool ContractionState::SetExpanded(int lineDoc, bool expanded) {
if (size == 0) {
+ if (expanded) {
+ // If in completely expanded state then setting
+ // one line to expanded has no effect.
+ return false;
+ }
Grow(linesInDoc + growSize);
}
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
@@ -252,6 +257,11 @@ bool ContractionState::SetHeight(int lineDoc, int height) {
if (lineDoc > linesInDoc)
return false;
if (size == 0) {
+ if (height == 1) {
+ // If in completely expanded state then all lines
+ // assumed to have height of one so no effect here.
+ return false;
+ }
Grow(linesInDoc + growSize);
}
if (lines[lineDoc].height != height) {