aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexPerl.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-04-05 08:43:01 +1000
committernyamatongwe <devnull@localhost>2011-04-05 08:43:01 +1000
commit8e6cb090c8f22c3e98e57f977063c36157e4bcdc (patch)
treeebd2f1001a30c65032dd2175c61ee4933b3670af /lexers/LexPerl.cxx
parent764ca26b04c08e010c4ec9526af8f72fa5210dd4 (diff)
downloadscintilla-mirror-8e6cb090c8f22c3e98e57f977063c36157e4bcdc.tar.gz
Adds a fold.perl.at.else property. Discussed in bug #3265401.
Diffstat (limited to 'lexers/LexPerl.cxx')
-rw-r--r--lexers/LexPerl.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx
index 310305fd5..67b8103ba 100644
--- a/lexers/LexPerl.cxx
+++ b/lexers/LexPerl.cxx
@@ -310,13 +310,15 @@ struct OptionsPerl {
bool foldComment;
bool foldCompact;
// Custom folding of POD and packages
- bool foldPOD; // property fold.perl.pod
+ bool foldPOD; // fold.perl.pod
// Enable folding Pod blocks when using the Perl lexer.
- bool foldPackage; // property fold.perl.package
+ bool foldPackage; // fold.perl.package
// Enable folding packages when using the Perl lexer.
bool foldCommentExplicit;
+ bool foldAtElse;
+
OptionsPerl() {
fold = false;
foldComment = false;
@@ -324,6 +326,7 @@ struct OptionsPerl {
foldPOD = true;
foldPackage = true;
foldCommentExplicit = true;
+ foldAtElse = false;
}
};
@@ -349,6 +352,9 @@ struct OptionSetPerl : public OptionSet<OptionsPerl> {
DefineProperty("fold.perl.comment.explicit", &OptionsPerl::foldCommentExplicit,
"Set to 0 to disable explicit folding.");
+ DefineProperty("fold.perl.at.else", &OptionsPerl::foldAtElse,
+ "This option enables Perl folding on a \"} else {\" line of an if statement.");
+
DefineWordListSets(perlWordListDesc);
}
};
@@ -1388,14 +1394,14 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
// {} [] block folding
if (style == SCE_PL_OPERATOR) {
if (ch == '{') {
- if (levelCurrent < levelPrev)
+ if (options.foldAtElse && levelCurrent < levelPrev)
--levelPrev;
levelCurrent++;
} else if (ch == '}') {
levelCurrent--;
}
if (ch == '[') {
- if (levelCurrent < levelPrev)
+ if (options.foldAtElse && levelCurrent < levelPrev)
--levelPrev;
levelCurrent++;
} else if (ch == ']') {