aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexPerl.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2005-06-02 00:24:28 +0000
committernyamatongwe <unknown>2005-06-02 00:24:28 +0000
commit44e0cf84b6062572548b2f27028e34368315ced4 (patch)
tree95a074dfacfbd4d034eed20952ebfff3d24e1f55 /src/LexPerl.cxx
parent3cbaf3397c289c30e5a127bfbc04519f4879ef78 (diff)
downloadscintilla-mirror-44e0cf84b6062572548b2f27028e34368315ced4.tar.gz
Modification by Kein-Hong Man for folding pod headings.
Diffstat (limited to 'src/LexPerl.cxx')
-rw-r--r--src/LexPerl.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx
index eff351151..2a3d4318d 100644
--- a/src/LexPerl.cxx
+++ b/src/LexPerl.cxx
@@ -938,6 +938,7 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
int styleNext = styler.StyleAt(startPos);
// Used at end of line to determine if the line was a package definition
bool isPackageLine = false;
+ bool isPodHeading = false;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -968,8 +969,10 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
if (style == SCE_PL_POD) {
if (stylePrevCh != SCE_PL_POD)
levelCurrent++;
- if (styler.Match(i, "=cut"))
+ else if (styler.Match(i, "=cut"))
levelCurrent--;
+ else if (styler.Match(i, "=head"))
+ isPodHeading = true;
}
}
// Custom package folding
@@ -988,6 +991,12 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
+ if (isPodHeading) {
+ lev = styler.LevelAt(lineCurrent) - 1;
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ styler.SetLevel(lineCurrent, lev);
+ isPodHeading = false;
+ }
// Check if line was a package declaration
// because packages need "special" treatment
if (isPackageLine) {