From d94214b41cc24a20d69076a4f6dbd43a48d137e2 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 31 Jan 2016 14:38:11 +1100 Subject: Replace expressions to find level number of a fold level with function call. Simplifies code by removing any precedence issues and is shorter. --- src/MarginView.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/MarginView.cxx') diff --git a/src/MarginView.cxx b/src/MarginView.cxx index f164a7cb1..52a2cb2dd 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -243,7 +243,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect levelPrev = model.pdoc->GetLevel(lineBack); } if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { - if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK)) + if (LevelNumber(level) < LevelNumber(levelPrev)) needWhiteClosure = true; } } @@ -279,8 +279,8 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect // Decide which fold indicator should be displayed const int level = model.pdoc->GetLevel(lineDoc); const int levelNext = model.pdoc->GetLevel(lineDoc + 1); - const int levelNum = level & SC_FOLDLEVELNUMBERMASK; - const int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK; + const int levelNum = LevelNumber(level); + const int levelNextNum = LevelNumber(levelNext); if (level & SC_FOLDLEVELHEADERFLAG) { if (firstSubLine) { if (levelNum < levelNextNum) { @@ -312,7 +312,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect needWhiteClosure = false; const int firstFollowupLine = model.cs.DocFromDisplay(model.cs.DisplayFromDoc(lineDoc + 1)); const int firstFollowupLineLevel = model.pdoc->GetLevel(firstFollowupLine); - const int secondFollowupLineLevelNum = model.pdoc->GetLevel(firstFollowupLine + 1) & SC_FOLDLEVELNUMBERMASK; + const int secondFollowupLineLevelNum = LevelNumber(model.pdoc->GetLevel(firstFollowupLine + 1)); if (!model.cs.GetExpanded(lineDoc)) { if ((firstFollowupLineLevel & SC_FOLDLEVELWHITEFLAG) && (levelNum > secondFollowupLineLevelNum)) @@ -380,7 +380,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect sprintf(number, "%c%c %03X %03X", (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - lev & SC_FOLDLEVELNUMBERMASK, + LevelNumber(lev), lev >> 16 ); } else { -- cgit v1.2.3