aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Document.cxx')
-rw-r--r--src/Document.cxx35
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;
}