diff options
| author | Prakash Sahni <unknown> | 2020-06-12 09:34:59 +1000 | 
|---|---|---|
| committer | Prakash Sahni <unknown> | 2020-06-12 09:34:59 +1000 | 
| commit | 1da92e82c03b517c9c814fce343d86d382a90a0a (patch) | |
| tree | 6a25f06b19774f48cf73fdaac8e8e48fdcec2c54 /src/Document.cxx | |
| parent | e1421b5feaff77e9a047a53a7859c577616fae2b (diff) | |
| download | scintilla-mirror-1da92e82c03b517c9c814fce343d86d382a90a0a.tar.gz | |
Bug [#2141]. Implement end of line annotations.
Diffstat (limited to 'src/Document.cxx')
| -rw-r--r-- | src/Document.cxx | 35 | 
1 files changed, 35 insertions, 0 deletions
| diff --git a/src/Document.cxx b/src/Document.cxx index ff009ee3e..f17e4f837 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -137,6 +137,7 @@ Document::Document(int options) :  	perLineData[ldState] = std::make_unique<LineState>();  	perLineData[ldMargin] = std::make_unique<LineAnnotation>();  	perLineData[ldAnnotation] = std::make_unique<LineAnnotation>(); +	perLineData[ldEOLAnnotation] = std::make_unique<LineAnnotation>();  	decorations = DecorationListCreate(IsLarge()); @@ -212,6 +213,10 @@ LineAnnotation *Document::Annotations() const noexcept {  	return dynamic_cast<LineAnnotation *>(perLineData[ldAnnotation].get());  } +LineAnnotation *Document::EOLAnnotations() const noexcept { +	return dynamic_cast<LineAnnotation *>(perLineData[ldEOLAnnotation].get()); +} +  int Document::LineEndTypesSupported() const {  	if ((SC_CP_UTF8 == dbcsCodePage) && pli)  		return pli->LineEndTypesSupported(); @@ -2385,6 +2390,36 @@ void Document::AnnotationClearAll() {  	Annotations()->ClearAll();  } +StyledText Document::EOLAnnotationStyledText(Sci::Line line) const noexcept { +	const LineAnnotation *pla = EOLAnnotations(); +	return StyledText(pla->Length(line), pla->Text(line), +		pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); +} + +void Document::EOLAnnotationSetText(Sci::Line line, const char *text) { +	if (line >= 0 && line < LinesTotal()) { +		EOLAnnotations()->SetText(line, text); +		DocModification mh(SC_MOD_CHANGEEOLANNOTATION, LineStart(line), +			0, 0, 0, line); +		NotifyModified(mh); +	} +} + +void Document::EOLAnnotationSetStyle(Sci::Line line, int style) { +	EOLAnnotations()->SetStyle(line, style); +	const DocModification mh(SC_MOD_CHANGEEOLANNOTATION, LineStart(line), +		0, 0, 0, line); +	NotifyModified(mh); +} + +void Document::EOLAnnotationClearAll() { +	const Sci::Line maxEditorLine = LinesTotal(); +	for (Sci::Line l=0; l<maxEditorLine; l++) +		EOLAnnotationSetText(l, nullptr); +	// Free remaining data +	EOLAnnotations()->ClearAll(); +} +  void Document::IncrementStyleClock() noexcept {  	styleClock = (styleClock + 1) % 0x100000;  } | 
