diff options
-rw-r--r-- | doc/ScintillaDoc.html | 7 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | src/Editor.cxx | 18 | ||||
-rw-r--r-- | src/LineMarker.cxx | 2 |
5 files changed, 24 insertions, 5 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index beb5ab115..94e6af19d 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -2975,11 +2975,12 @@ struct TextToFind { <code>SC_MARK_SMALLRECT</code>, <code>SC_MARK_SHORTARROW</code>, <code>SC_MARK_EMPTY</code>, <code>SC_MARK_ARROWDOWN</code>, <code>SC_MARK_MINUS</code>, <code>SC_MARK_PLUS</code>, <code>SC_MARK_ARROWS</code>, <code>SC_MARK_DOTDOTDOT</code>, <code>SC_MARK_EMPTY</code>, - <code>SC_MARK_BACKGROUND</code>, <code>SC_MARK_LEFTRECT</code> - and <code>SC_MARK_FULLRECT</code>.</p> + <code>SC_MARK_BACKGROUND</code>, <code>SC_MARK_LEFTRECT</code>, + <code>SC_MARK_FULLRECT</code>, and <code>SC_MARK_UNDERLINE</code>.</p> <p>The <code>SC_MARK_BACKGROUND</code> marker changes the background colour of the line only. The <code>SC_MARK_FULLRECT</code> symbol mirrors this, changing only the margin background colour. + <code>SC_MARK_UNDERLINE</code> draws an underline across the text. The <code>SC_MARK_EMPTY</code> 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 <code>SC_FOLDERNUM_</code>* markers to have no associated symbol.</p> @@ -3140,7 +3141,7 @@ struct TextToFind { <p><b id="SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int <a class="jump" href="#alpha">alpha</a>)</b><br /> 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 <code>SC_MARK_BACKGROUND</code> or <code>SC_MARK_UNDERLINE</code> types, they may be drawn translucently by setting an alpha value.</p> <p><b id="SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</b><br /> 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) { |