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 | 6f4b79e79021211bbf1c7856bfa3b9d18428ccef (patch) | |
tree | a66f8d26c9e6c70e6aa7467cc4261e07a71c0e1c /src/MarginView.cxx | |
parent | 5e577a9d73983a9ec1ba6a8224e59fca1c3691f6 (diff) | |
download | scintilla-mirror-6f4b79e79021211bbf1c7856bfa3b9d18428ccef.tar.gz |
When a text margin is displayed, for annotation lines, use the background colour
of the base line.
From Joe Mueller.
Diffstat (limited to 'src/MarginView.cxx')
-rw-r--r-- | src/MarginView.cxx | 18 |
1 files changed, 13 insertions, 5 deletions
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); + } } } } |