aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authorPrakash Sahni <unknown>2020-06-12 09:34:59 +1000
committerPrakash Sahni <unknown>2020-06-12 09:34:59 +1000
commitee0f914744608d9a859aa7212fe839e5e638776e (patch)
tree3c2546438e5a28d792d8f896e6df84f940e64b04 /src/Editor.cxx
parent7bdbad1346fa2d34ab37d7fd7d1574b78f879b6f (diff)
downloadscintilla-mirror-ee0f914744608d9a859aa7212fe839e5e638776e.tar.gz
Backport: Bug [#2141]. Implement end of line annotations.
Backport of changeset 8306:1b383adfdf71.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index e655b7e82..195be8a01 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2122,6 +2122,7 @@ void Editor::ClearAll() {
if (!pdoc->IsReadOnly()) {
pcs->Clear();
pdoc->AnnotationClearAll();
+ pdoc->EOLAnnotationClearAll();
pdoc->MarginClearAll();
}
}
@@ -2657,6 +2658,11 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
Redraw();
}
}
+ if (mh.modificationType & SC_MOD_CHANGEEOLANNOTATION) {
+ if (vs.eolAnnotationVisible) {
+ Redraw();
+ }
+ }
CheckModificationForWrap(mh);
if (mh.linesAdded != 0) {
// Avoid scrolling of display if change before current display
@@ -5298,6 +5304,13 @@ void Editor::SetAnnotationVisible(int visible) {
}
}
+void Editor::SetEOLAnnotationVisible(int visible) {
+ if (vs.eolAnnotationVisible != visible) {
+ vs.eolAnnotationVisible = visible;
+ Redraw();
+ }
+}
+
/**
* Recursively expand a fold, making lines visible except where they have an unexpanded parent.
*/
@@ -8055,6 +8068,43 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_ANNOTATIONGETSTYLEOFFSET:
return vs.annotationStyleOffset;
+ case SCI_EOLANNOTATIONSETTEXT:
+ pdoc->EOLAnnotationSetText(static_cast<Sci::Line>(wParam), CharPtrFromSPtr(lParam));
+ break;
+
+ case SCI_EOLANNOTATIONGETTEXT: {
+ const StyledText st = pdoc->EOLAnnotationStyledText(static_cast<Sci::Line>(wParam));
+ return BytesResult(lParam, reinterpret_cast<const unsigned char *>(st.text), st.length);
+ }
+
+ case SCI_EOLANNOTATIONGETSTYLE: {
+ const StyledText st = pdoc->EOLAnnotationStyledText(static_cast<Sci::Line>(wParam));
+ return st.style;
+ }
+
+ case SCI_EOLANNOTATIONSETSTYLE:
+ pdoc->EOLAnnotationSetStyle(static_cast<Sci::Line>(wParam), static_cast<int>(lParam));
+ break;
+
+ case SCI_EOLANNOTATIONCLEARALL:
+ pdoc->EOLAnnotationClearAll();
+ break;
+
+ case SCI_EOLANNOTATIONSETVISIBLE:
+ SetEOLAnnotationVisible(static_cast<int>(wParam));
+ break;
+
+ case SCI_EOLANNOTATIONGETVISIBLE:
+ return vs.eolAnnotationVisible;
+
+ case SCI_EOLANNOTATIONSETSTYLEOFFSET:
+ vs.eolAnnotationStyleOffset = static_cast<int>(wParam);
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_EOLANNOTATIONGETSTYLEOFFSET:
+ return vs.eolAnnotationStyleOffset;
+
case SCI_RELEASEALLEXTENDEDSTYLES:
vs.ReleaseAllExtendedStyles();
break;