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 | e2ac00d7e452d30d4fc005647d503fd247c13ba5 (patch) | |
| tree | d9d5b76e44108b79b4d283c32d202c9e88ab407e /src/ContractionState.cxx | |
| parent | e08104d60449701647a0f71f6514e7d47d2d701b (diff) | |
| download | scintilla-mirror-e2ac00d7e452d30d4fc005647d503fd247c13ba5.tar.gz | |
Optimize InsertLines and DeleteLines for ContractionState if no folds contracted.
Diffstat (limited to 'src/ContractionState.cxx')
| -rw-r--r-- | src/ContractionState.cxx | 16 | 
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 565f9e141..8b5821470 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -210,16 +210,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();  }  | 
