From 138a30cbbb39eb8d3c3588532b20c0026a8e76ca Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 16 Apr 2011 19:50:45 +1000 Subject: =?UTF-8?q?Better=20highlight=20drawing=20where=20fold=20header=20?= =?UTF-8?q?has=20no=20subordinates.=20Bug=20#3279730.=20From=20J=C3=A9r?= =?UTF-8?q?=C3=B4me=20LAFORGE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Document.cxx | 11 +++++++---- src/Document.h | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/Document.cxx b/src/Document.cxx index f74ac5830..b9b284e96 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -399,14 +399,15 @@ void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDel } } else if (!(lineLookLevel & SC_FOLDLEVELWHITEFLAG)) { endOfTailOfWhiteFlag = lineLook - 1; - if (lineLookLevel & SC_FOLDLEVELHEADERFLAG) { + levelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK; + if (lineLookLevel & SC_FOLDLEVELHEADERFLAG && + //Managed the folding block when a fold header does not have any subordinate lines to fold away. + (levelNumber < (GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK))) { beginFoldBlockFound = true; beginFoldBlock = lineLook; beginMarginCorrectlyDrawnZoneFound = true; beginMarginCorrectlyDrawnZone = endOfTailOfWhiteFlag; levelNumber = GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK;; - } else { - levelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK; } } } @@ -434,7 +435,9 @@ void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDel endFoldBlockFound = true; endFoldBlock = -1; } - if (!endMarginCorrectlyDrawnZoneFound && (lineLookLevel & SC_FOLDLEVELHEADERFLAG)) { + if (!endMarginCorrectlyDrawnZoneFound && (lineLookLevel & SC_FOLDLEVELHEADERFLAG) && + //Managed the folding block when a fold header does not have any subordinate lines to fold away. + (levelNumber < (GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK))) { endMarginCorrectlyDrawnZoneFound = true; endMarginCorrectlyDrawnZone = lineLook; } diff --git a/src/Document.h b/src/Document.h index 851c10081..125a4a0a6 100644 --- a/src/Document.h +++ b/src/Document.h @@ -130,7 +130,7 @@ public: } bool isCurrentBlockHighlight(int line) { - return isEnabled && beginFoldBlock <= line && line <= endFoldBlock; + return isEnabled && beginFoldBlock != -1 && beginFoldBlock <= line && line <= endFoldBlock; } bool isHeadBlockFold(int line) { @@ -138,17 +138,17 @@ public: } bool isBodyBlockFold(int line) { - return beginFoldBlock < line && line < endFoldBlock; + return beginFoldBlock != -1 && beginFoldBlock < line && line < endFoldBlock; } bool isTailBlockFold(int line) { - return beginFoldBlock < line && line == endFoldBlock; + return beginFoldBlock != -1 && beginFoldBlock < line && line == endFoldBlock; } // beginFoldBlock : Begin of current fold block. - // endStartBlock : End of zone where margin is already drawn. - // beginMarginCorrectlyDrawnZone : Begin of zone where margin is already drawn. - // endMarginCorrectlyDrawnZone : End of current fold block. + // endStartBlock : End of current fold block. + // beginMarginCorrectlyDrawnZone : Begin of zone where margin is correctly drawn. + // endMarginCorrectlyDrawnZone : End of zone where margin is correctly drawn. int beginFoldBlock; int endFoldBlock; int beginMarginCorrectlyDrawnZone; -- cgit v1.2.3