From 0b8c36cab8870bfbfb08463e6682da3b213806b5 Mon Sep 17 00:00:00 2001
From: nyamatongwe SC_MARK_SMALLRECT, SC_MARK_SHORTARROW, SC_MARK_EMPTY,
SC_MARK_ARROWDOWN, SC_MARK_MINUS, SC_MARK_PLUS,
SC_MARK_ARROWS, SC_MARK_DOTDOTDOT, SC_MARK_EMPTY,
- SC_MARK_BACKGROUND, SC_MARK_LEFTRECT
- and SC_MARK_FULLRECT.
SC_MARK_BACKGROUND, SC_MARK_LEFTRECT,
+ SC_MARK_FULLRECT, and SC_MARK_UNDERLINE.
The SC_MARK_BACKGROUND marker changes the background colour of the line only.
The SC_MARK_FULLRECT symbol mirrors this, changing only the margin background colour.
+ SC_MARK_UNDERLINE draws an underline across the text.
The SC_MARK_EMPTY symbol is invisible, allowing client code to track the movement
of lines. You would also use it if you changed the folding style and wanted one or more of the
SC_FOLDERNUM_* markers to have no associated symbol.
SCI_MARKERSETALPHA(int markerNumber, int alpha)
When markers are drawn in the content area, either because there is no margin for them or
- they are of SC_MARK_BACKGROUND type, they may be drawn translucently by
+ they are of SC_MARK_BACKGROUND or SC_MARK_UNDERLINE types, they may be drawn translucently by
setting an alpha value.
SCI_MARKERADD(int line, int markerNumber)
diff --git a/include/Scintilla.h b/include/Scintilla.h
index d3dd18b87..2cbecfb67 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -120,6 +120,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARK_FULLRECT 26
#define SC_MARK_LEFTRECT 27
#define SC_MARK_AVAILABLE 28
+#define SC_MARK_UNDERLINE 29
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 76c31f7be..d0f376fa5 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -270,6 +270,7 @@ val SC_MARK_PIXMAP=25
val SC_MARK_FULLRECT=26
val SC_MARK_LEFTRECT=27
val SC_MARK_AVAILABLE=28
+val SC_MARK_UNDERLINE=29
val SC_MARK_CHARACTER=10000
diff --git a/src/Editor.cxx b/src/Editor.cxx
index a67821147..80156e6af 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2532,6 +2532,18 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated);
}
+ // Draw underline mark as part of background if not transparent
+ int marks = pdoc->GetMark(line);
+ for (int markBit = 0; (markBit < 32) && marks; markBit++) {
+ if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE) &&
+ (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
+ PRectangle rcUnderline = rcLine;
+ rcUnderline.top = rcUnderline.bottom - 2;
+ surface->FillRectangle(rcUnderline, vsDraw.markers[markBit].back.allocated);
+ }
+ marks >>= 1;
+ }
+
inIndentation = subLine == 0; // Do not handle indentation except on first subline.
// Foreground drawing loop
BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible);
@@ -2748,10 +2760,14 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha);
}
- int marks = pdoc->GetMark(line);
+ marks = pdoc->GetMark(line);
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
+ } else if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE)) {
+ PRectangle rcUnderline = rcSegment;
+ rcUnderline.top = rcUnderline.bottom - 2;
+ SimpleAlphaRectangle(surface, rcUnderline, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
}
marks >>= 1;
}
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index f79c3c085..f79f4f48a 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -154,7 +154,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
rcSmall.bottom = rc.bottom - 2;
surface->RectangleDraw(rcSmall, fore.allocated, back.allocated);
- } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND) {
+ } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND || markType == SC_MARK_UNDERLINE) {
// An invisible marker so don't draw anything
} else if (markType == SC_MARK_VLINE) {
--
cgit v1.2.3