diff options
author | Neil <nyamatongwe@gmail.com> | 2014-12-16 09:57:13 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-12-16 09:57:13 +1100 |
commit | 8b25ec48c38cfb0f7a6684ab6856aa6c286601cd (patch) | |
tree | 011d8fbd1d8528935bd913b3613bf803b7260b84 | |
parent | cc68e9e5f61edaebff071e4628c837c5a22b1597 (diff) | |
download | scintilla-mirror-8b25ec48c38cfb0f7a6684ab6856aa6c286601cd.tar.gz |
When a text margin is displayed, for annotation lines, use the background colour
of the base line.
From Joe Mueller.
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | src/MarginView.cxx | 18 |
2 files changed, 17 insertions, 5 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 340bcc234..79e5e398b 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -464,6 +464,7 @@ <td>Erik Angelin</td> <td>Yusuf Ramazan Karagöz</td> <td>Markus Heidelberg</td> + <td>Joe Mueller</td> </tr> </table> <p> @@ -495,6 +496,9 @@ position that avoids overlapping the Scintilla text. </li> <li> + When a text margin is displayed, for annotation lines, use the background colour of the base line. + </li> + <li> Reverted a fix on Qt where Qt 5.3 has returned to the behaviour of 4.x. <a href="http://sourceforge.net/p/scintilla/bugs/1575/">Bug #1575</a>. </li> diff --git a/src/MarginView.cxx b/src/MarginView.cxx index b7ef48513..a6fc1f40b 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -263,8 +263,10 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect PLATFORM_ASSERT(visibleLine < model.cs.LinesDisplayed()); const int lineDoc = model.cs.DocFromDisplay(visibleLine); PLATFORM_ASSERT(model.cs.GetVisible(lineDoc)); - const bool firstSubLine = visibleLine == model.cs.DisplayFromDoc(lineDoc); - const bool lastSubLine = visibleLine == model.cs.DisplayLastFromDoc(lineDoc); + const int firstVisibleLine = model.cs.DisplayFromDoc(lineDoc); + const int lastVisibleLine = model.cs.DisplayLastFromDoc(lineDoc); + const bool firstSubLine = visibleLine == firstVisibleLine; + const bool lastSubLine = visibleLine == lastVisibleLine; int marks = model.pdoc->GetMark(lineDoc); if (!firstSubLine) @@ -403,9 +405,9 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect } } } else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) { - if (firstSubLine) { - const StyledText stMargin = model.pdoc->MarginStyledText(lineDoc); - if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) { + const StyledText stMargin = model.pdoc->MarginStyledText(lineDoc); + if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) { + if (firstSubLine) { surface->FillRectangle(rcMarker, vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); if (vs.ms[margin].style == SC_MARGIN_RTEXT) { @@ -414,6 +416,12 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect } DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, stMargin, 0, stMargin.length, drawAll); + } else { + // if we're displaying annotation lines, color the margin to match the associated document line + const int annotationLines = model.pdoc->AnnotationLines(lineDoc); + if (annotationLines && (visibleLine > lastVisibleLine - annotationLines)) { + surface->FillRectangle(rcMarker, vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); + } } } } |