aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--src/EditView.cxx16
2 files changed, 13 insertions, 6 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 4c66611ba..1b88ebab1 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -575,6 +575,9 @@
Released 26 July 2021.
</li>
<li>
+ Fix display of fold lines when wrapped so they are only drawn once per line, not on each subline.
+ </li>
+ <li>
On Cocoa, fix memory leak caused by circular references.
<a href="https://sourceforge.net/p/scintilla/bugs/2268/">Bug #2268</a>.
</li>
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)) {