From 9d868eab3b8afad86a0ef8b60aba732f066ab52c Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 7 Aug 2001 08:12:59 +0000 Subject: Fixed up problem with outlining folding margin where folder tails were not displayed if the display starts on a whitespace line. --- src/Editor.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index 436b20795..5e31a165c 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -712,21 +712,28 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { int visibleLine = topLine; int line = cs.DocFromDisplay(visibleLine); int yposScreen = 0; - bool needWhiteClosure = false; + + // Work out whether the top line is whitespace located after a + // lessening of fold level which implies a 'fold tail' but which should not + // be displayed until the last of a sequence of whitespace. + bool needWhiteClosure = false; int level = pdoc->GetLevel(line); if (level & SC_FOLDLEVELWHITEFLAG) { - int lineBack = line-1; - while ((lineBack > 0) && (level & SC_FOLDLEVELWHITEFLAG)) { + int lineBack = line; + int levelPrev = level; + while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) { lineBack--; - level = pdoc->GetLevel(lineBack); + levelPrev = pdoc->GetLevel(lineBack); } - if (!(level & SC_FOLDLEVELHEADERFLAG) && (lineBack > 0)) { - int levelPrev = pdoc->GetLevel(lineBack-1); + if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK)) needWhiteClosure = true; } } + while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) { + + // Decide which fold indicator should be displayed level = pdoc->GetLevel(line); int levelNext = pdoc->GetLevel(line+1); int marks = pdoc->GetMark(line); @@ -772,6 +779,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { marks |= 1 << SC_MARKNUM_FOLDERSUB; } } + marks &= vs.ms[margin].mask; PRectangle rcMarker = rcSelMargin; rcMarker.top = yposScreen; -- cgit v1.2.3