aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/EditView.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2026-01-17 10:16:35 +1100
committerNeil <nyamatongwe@gmail.com>2026-01-17 10:16:35 +1100
commitb89a4865d66ae4a5a002f98c3be9db5bc12efffc (patch)
treec36e5996e234ccd4231addd4a30d5833867a7f74 /src/EditView.cxx
parentd718aef662efafad72d5880def81641f80db99a9 (diff)
downloadscintilla-mirror-b89a4865d66ae4a5a002f98c3be9db5bc12efffc.tar.gz
Hoist calculation of last style of line into function and simplify logic.master
Diffstat (limited to 'src/EditView.cxx')
-rw-r--r--src/EditView.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index df772395e..ee2789ee6 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -935,8 +935,8 @@ void FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle
const ColourOptional background = vsDraw.Background(model.GetMark(line), model.caret.active, ll->containsCaret);
if (background) {
surface->FillRectangleAligned(rcArea, Fill(*background));
- } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) {
- surface->FillRectangleAligned(rcArea, Fill(vsDraw.styles[ll->styles[ll->numCharsInLine]].back));
+ } else if (vsDraw.styles[ll->LastStyle()].eolFilled) {
+ surface->FillRectangleAligned(rcArea, Fill(vsDraw.styles[ll->LastStyle()].back));
} else {
surface->FillRectangleAligned(rcArea, Fill(vsDraw.styles[StyleDefault].back));
}
@@ -1010,7 +1010,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
if (virtualSpace > 0.0f) {
rcSegment.left = xEol + xStart;
rcSegment.right = xEol + xStart + virtualSpace;
- const ColourRGBA backgroundFill = background.value_or(vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
+ const ColourRGBA backgroundFill = background.value_or(vsDraw.styles[ll->LastStyle()].back);
surface->FillRectangleAligned(rcSegment, backgroundFill);
if (vsDraw.selection.visible && (vsDraw.selection.layer == Layer::Base)) {
const SelectionSegment virtualSpaceRange(SelectionPosition(model.pdoc->LineEnd(line)),
@@ -1115,12 +1115,13 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
} else {
if (background) {
surface->FillRectangleAligned(rcSegment, Fill(*background));
- } else if (line < model.pdoc->LinesTotal() - 1) {
- surface->FillRectangleAligned(rcSegment, Fill(vsDraw.styles[ll->styles[ll->numCharsInLine]].back));
- } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) {
- surface->FillRectangleAligned(rcSegment, Fill(vsDraw.styles[ll->styles[ll->numCharsInLine]].back));
} else {
- surface->FillRectangleAligned(rcSegment, Fill(vsDraw.styles[StyleDefault].back));
+ const Style &styleLast = vsDraw.styles[ll->LastStyle()];
+ if ((line < model.pdoc->LinesTotal() - 1) || styleLast.eolFilled) {
+ surface->FillRectangleAligned(rcSegment, Fill(styleLast.back));
+ } else {
+ surface->FillRectangleAligned(rcSegment, Fill(vsDraw.styles[StyleDefault].back));
+ }
}
if (eolInSelection && (line < model.pdoc->LinesTotal() - 1) && (vsDraw.selection.layer != Layer::Base)) {
surface->FillRectangleAligned(rcSegment, selectionBack);