diff options
| author | Tse Kit Yam <me@kytse.com> | 2016-11-29 14:14:21 +1100 | 
|---|---|---|
| committer | Tse Kit Yam <me@kytse.com> | 2016-11-29 14:14:21 +1100 | 
| commit | 4ae76e455aec66826a284356d63cc2b5995c0b2f (patch) | |
| tree | c0466475514dee0da647dfa800cb1ccfc4647f0e /src/ContractionState.cxx | |
| parent | 6bed4e4aa02025e1bd0c294a44c9371fb6b176f1 (diff) | |
| download | scintilla-mirror-4ae76e455aec66826a284356d63cc2b5995c0b2f.tar.gz | |
Textual tags may be displayed on folded lines with SCI_TOGGLEFOLDSHOWTEXT.
Diffstat (limited to 'src/ContractionState.cxx')
| -rw-r--r-- | src/ContractionState.cxx | 32 | 
1 files changed, 31 insertions, 1 deletions
| diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 80f79de29..41627c173 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -6,6 +6,7 @@  // The License.txt file describes the conditions under which this software may be distributed.  #include <string.h> +#include <assert.h>  #include <stdexcept>  #include <algorithm> @@ -16,13 +17,14 @@  #include "SplitVector.h"  #include "Partitioning.h"  #include "RunStyles.h" +#include "SparseVector.h"  #include "ContractionState.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif -ContractionState::ContractionState() : visible(0), expanded(0), heights(0), displayLines(0), linesInDocument(1) { +ContractionState::ContractionState() : visible(0), expanded(0), heights(0), foldDisplayTexts(0), displayLines(0), linesInDocument(1) {  	//InsertLine(0);  } @@ -35,6 +37,7 @@ void ContractionState::EnsureData() {  		visible = new RunStyles();  		expanded = new RunStyles();  		heights = new RunStyles(); +		foldDisplayTexts = new SparseVector<const char *>();  		displayLines = new Partitioning(4);  		InsertLines(0, linesInDocument);  	} @@ -47,6 +50,8 @@ void ContractionState::Clear() {  	expanded = 0;  	delete heights;  	heights = 0; +	delete foldDisplayTexts; +	foldDisplayTexts = 0;  	delete displayLines;  	displayLines = 0;  	linesInDocument = 1; @@ -108,6 +113,8 @@ void ContractionState::InsertLine(int lineDoc) {  		expanded->SetValueAt(lineDoc, 1);  		heights->InsertSpace(lineDoc, 1);  		heights->SetValueAt(lineDoc, 1); +		foldDisplayTexts->InsertSpace(lineDoc, 1); +		foldDisplayTexts->SetValueAt(lineDoc, NULL);  		int lineDisplay = DisplayFromDoc(lineDoc);  		displayLines->InsertPartition(lineDoc, lineDisplay);  		displayLines->InsertText(lineDoc, 1); @@ -132,6 +139,7 @@ void ContractionState::DeleteLine(int lineDoc) {  		visible->DeleteRange(lineDoc, 1);  		expanded->DeleteRange(lineDoc, 1);  		heights->DeleteRange(lineDoc, 1); +		foldDisplayTexts->DeletePosition(lineDoc);  	}  } @@ -184,6 +192,24 @@ bool ContractionState::HiddenLines() const {  	}  } +const char *ContractionState::GetFoldDisplayText(int lineDoc) const { +	Check(); +	return foldDisplayTexts->ValueAt(lineDoc); +} + +bool ContractionState::SetFoldDisplayText(int lineDoc, const char *text) { +	EnsureData(); +	const char *foldText = foldDisplayTexts->ValueAt(lineDoc); +	if (!foldText || 0 != strcmp(text, foldText)) { +		foldDisplayTexts->SetValueAt(lineDoc, text); +		Check(); +		return true; +	} else { +		Check(); +		return false; +	} +} +  bool ContractionState::GetExpanded(int lineDoc) const {  	if (OneToOne()) {  		return true; @@ -209,6 +235,10 @@ bool ContractionState::SetExpanded(int lineDoc, bool isExpanded) {  	}  } +bool ContractionState::GetFoldDisplayTextShown(int lineDoc) const { +	return !GetExpanded(lineDoc) && GetFoldDisplayText(lineDoc); +} +  int ContractionState::ContractedNext(int lineDocStart) const {  	if (OneToOne()) {  		return -1; | 
