aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-07-29 12:39:34 +1000
committerNeil <nyamatongwe@gmail.com>2021-07-29 12:39:34 +1000
commit01b1affdce7ee869c62a88ab23486b55b7707764 (patch)
treedb3e33549fc698b8238ee1aeecb91f77d623570e /src
parent2a32ab1ac379271dd1b526f5ff01a67118284e96 (diff)
downloadscintilla-mirror-01b1affdce7ee869c62a88ab23486b55b7707764.tar.gz
Fix display of fold lines when wrapped so they are only drawn once per line, not
on each subline.
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index ba1301d70..f4d37e221 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -2281,22 +2281,26 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl
}
}
-static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, Sci::Line line, PRectangle rcLine) {
+static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
+ Sci::Line line, PRectangle rcLine, int subLine) {
+ const bool lastSubLine = subLine == (ll->lines - 1);
const bool expanded = model.pcs->GetExpanded(line);
const FoldLevel level = model.pdoc->GetFoldLevel(line);
const FoldLevel levelNext = model.pdoc->GetFoldLevel(line + 1);
if (LevelIsHeader(level) &&
(LevelNumber(level) < LevelNumber(levelNext))) {
// Paint the line above the fold
- if ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeExpanded)))
+ if ((subLine == 0) &&
+ ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeExpanded)))
||
- (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeContracted)))) {
+ (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeContracted))))) {
surface->FillRectangleAligned(Side(rcLine, Edge::top, 1.0), Fill(vsDraw.styles[StyleDefault].fore));
}
// Paint the line below the fold
- if ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterExpanded)))
+ if (lastSubLine &&
+ ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterExpanded)))
||
- (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterContracted)))) {
+ (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterContracted))))) {
surface->FillRectangleAligned(Side(rcLine, Edge::bottom, 1.0), Fill(vsDraw.styles[StyleDefault].fore));
}
}
@@ -2428,7 +2432,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan
ll->RestoreBracesHighlight(rangeLine, model.braces, bracesIgnoreStyle);
if (FlagSet(phase, DrawPhase::foldLines)) {
- DrawFoldLines(surface, model, vsDraw, lineDoc, rcLine);
+ DrawFoldLines(surface, model, vsDraw, ll.get(), lineDoc, rcLine, subLine);
}
if (FlagSet(phase, DrawPhase::carets)) {