diff options
author | nyamatongwe <unknown> | 2004-10-03 12:19:20 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2004-10-03 12:19:20 +0000 |
commit | d941fb8a26c981607fc401f06931e0861f14efa2 (patch) | |
tree | 52efa9809e99656e22af522e2d070c03427ad357 /src | |
parent | 640b1e0607283d422b90b2f02e80680ac885af71 (diff) | |
download | scintilla-mirror-d941fb8a26c981607fc401f06931e0861f14efa2.tar.gz |
Anonymous patch to use base fold level for properties files and
the start of reg files before first [header] line.
Diffstat (limited to 'src')
-rw-r--r-- | src/LexOthers.cxx | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index 59d911255..f777e300f 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -330,6 +330,7 @@ static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], A char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); bool headerPoint = false; + int lev; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; @@ -339,21 +340,32 @@ static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], A styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (style==2) { + if (style == SCE_PROPS_SECTION) { headerPoint = true; } if (atEOL) { - int lev = SC_FOLDLEVELBASE+1; - if (headerPoint) - lev = SC_FOLDLEVELBASE; + lev = SC_FOLDLEVELBASE; + + if (lineCurrent > 0) { + int levelPrevious = styler.LevelAt(lineCurrent - 1); + if (levelPrevious & SC_FOLDLEVELHEADERFLAG) { + lev = SC_FOLDLEVELBASE + 1; + } else { + lev = levelPrevious & SC_FOLDLEVELNUMBERMASK; + } + } + + if (headerPoint) { + lev = SC_FOLDLEVELBASE; + } if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; - if (headerPoint) + if (headerPoint) { lev |= SC_FOLDLEVELHEADERFLAG; - + } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } @@ -366,9 +378,18 @@ static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], A visibleChars++; } - int lev = headerPoint ? SC_FOLDLEVELBASE : SC_FOLDLEVELBASE+1; - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, lev | flagsNext); + if (lineCurrent > 0) { + int levelPrevious = styler.LevelAt(lineCurrent - 1); + if (levelPrevious & SC_FOLDLEVELHEADERFLAG) { + lev = SC_FOLDLEVELBASE + 1; + } else { + lev = levelPrevious & SC_FOLDLEVELNUMBERMASK; + } + } else { + lev = SC_FOLDLEVELBASE; + } + int flagsNext = styler.LevelAt(lineCurrent); + styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK); } static void ColouriseMakeLine( |