diff options
| author | Neil <nyamatongwe@gmail.com> | 2026-03-07 10:27:10 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2026-03-07 10:27:10 +1100 |
| commit | 482a13cf879ae07a5f6c72fba84d994bde3a4852 (patch) | |
| tree | 2e9fa0450e7c2a20d7022e5c47f4d84fad56b3b1 /src | |
| parent | 1244953d437f8d0e4adc89fe4e887189961f9841 (diff) | |
| download | scintilla-mirror-482a13cf879ae07a5f6c72fba84d994bde3a4852.tar.gz | |
In visible whitespace modes, when there are contiguous spaces, paint the
background of the whole space range in one FillRectangleAligned call instead of
a call per space.
This reduces graphics calls and eliminates seams between the spaces when drawn
in some scaled environments.
The main background filling call was moved outside the representation test to
emphasize that it always occurs thus causing all the text area to have a defined
background colour.
Diffstat (limited to 'src')
| -rw-r--r-- | src/EditView.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index a1b0d61ab..d1e9c4103 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1683,21 +1683,27 @@ void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &v // Blob display inIndentation = false; } - surface->FillRectangleAligned(rcSegment, Fill(textBack)); - } else { + } + surface->FillRectangleAligned(rcSegment, Fill(textBack)); + if (!ts.representation) { // Normal text display - surface->FillRectangleAligned(rcSegment, Fill(textBack)); if (vsDraw.viewWhitespace != WhiteSpace::Invisible) { - for (int cpos = 0; cpos <= i - ts.start; cpos++) { - if (ll->chars[cpos + ts.start] == ' ') { + for (int cpos = 0; cpos <= i - ts.start; ) { + int countSpaces = 0; + while ((countSpaces <= i - ts.start - cpos) && (ll->chars[cpos + ts.start + countSpaces] == ' ')) { + countSpaces++; + } + if (countSpaces) { if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) { const PRectangle rcSpace = Intersection(rcLine, - ll->SpanByte(cpos + ts.start).Offset(horizontalOffset)); + ll->Span(cpos + ts.start, cpos + ts.start + countSpaces).Offset(horizontalOffset)); surface->FillRectangleAligned(rcSpace, vsDraw.ElementColourForced(Element::WhiteSpaceBack).Opaque()); } + cpos += countSpaces; } else { inIndentation = false; + cpos++; } } } |
