From ed7e87bfd2dfb8cbbab786b3742385de9d1e6a2a Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 25 Sep 2022 11:33:59 +1000 Subject: Draw lines more consistently in SC_PHASES_TWO and SC_PHASES_ONE modes by clipping drawing to just the line rectangle. --- doc/ScintillaHistory.html | 6 ++++++ src/EditView.cxx | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 8f2a6206c..2224ca420 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -589,6 +589,12 @@ and was exposed by ScintillaDocument in the Qt implementation of ScintillaEdit.
  • + Draw lines more consistently in SC_PHASES_TWO and SC_PHASES_ONE modes by + clipping drawing to just the line rectangle. + This stops drawing some extreme ascenders, descenders and portions of indicators which + may appear and then disappear depending on which lines were drawn. +
  • +
  • On Win32 implement horizontal scrolling mouse wheel. Feature #1450.
  • diff --git a/src/EditView.cxx b/src/EditView.cxx index 100d3d18b..2290cf8a6 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -2354,6 +2354,11 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl return; // No further drawing } + const bool clipLine = !bufferedDraw && !LinesOverlap(); + if (clipLine) { + surface->SetClip(rcLine); + } + // See if something overrides the line background colour. const std::optional background = vsDraw.Background(model.GetMark(line), model.caret.active, ll->containsCaret); @@ -2429,6 +2434,10 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl if (FlagSet(phase, DrawPhase::lineTranslucent)) { DrawTranslucentLineState(surface, model, vsDraw, ll, line, rcLine, subLine, Layer::OverText); } + + if (clipLine) { + surface->PopClip(); + } } static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, -- cgit v1.2.3