Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

patch for C++ fold.comment.explicit - fold //{

19 views
Skip to first unread message

Nick Treleaven

unread,
Jun 30, 2010, 7:25:51 AM6/30/10
to scintilla...@googlegroups.com
Hi,
According to:
http://www.scintilla.org/SciTEFAQ.html#ExplicitFolds

It seems you can disable explicit folding with:
fold.comment=0

But this also disables all folding of /* */ comments. (Maybe the FAQ
should mention this).

I think it would be great if there was an independent setting
like:
fold.comment.explicit=0

Please find patch attached - the property defaults to on if
fold.comment is enabled, so existing behaviour is preserved.

Thanks,
Nick

cxx_fold.comment.explicit.patch

Neil Hodgson

unread,
Jun 30, 2010, 6:58:28 PM6/30/10
to scintilla...@googlegroups.com
Nick Treleaven:

> Please find patch attached - the property defaults to on if
> fold.comment is enabled, so existing behaviour is preserved.

Due to the large scale changes to lexers currently underway for the
new lexer interface, I am not accepting patches until the new lexer
interface is committed to the mainline. I will look at this after that
happens.

The explanation could be misconstrued as fold.comment.explicit=1
ensuring folding of explicit folds whereas really it is a constraining
property. Perhaps something about fold.comment.explicit=0 disabling
the folding of explicit fold points when fold.comment=1.

Neil

Neil Hodgson

unread,
Jun 30, 2010, 8:05:45 PM6/30/10
to scintilla...@googlegroups.com
To prevent clashes and make it easier to track properties, there is
a naming convention for properties. New properties that affect lexers
and folders should have names that start with lexer.<lexer> and
fold.<lexer> so this one should be named fold.cpp.comment.explicit.

Neil

Nick Treleaven

unread,
Jul 1, 2010, 7:29:11 AM7/1/10
to scintilla...@googlegroups.com
On Thu, 1 Jul 2010 08:58:28 +1000
Neil Hodgson <nyama...@gmail.com> wrote:

> > Please find patch attached - the property defaults to on if
> > fold.comment is enabled, so existing behaviour is preserved.
>
> Due to the large scale changes to lexers currently underway for the
> new lexer interface, I am not accepting patches until the new lexer
> interface is committed to the mainline. I will look at this after that
> happens.

OK, no problem.

> The explanation could be misconstrued as fold.comment.explicit=1
> ensuring folding of explicit folds whereas really it is a constraining
> property. Perhaps something about fold.comment.explicit=0 disabling
> the folding of explicit fold points when fold.comment=1.

See new patch attached. The comment explains this now.
I renamed the property fold.cpp.comment.explicit as suggested in your
other mail.

Thanks,
Nick

fold.cpp.comment.explicit.patch

Neil Hodgson

unread,
Jul 16, 2010, 8:44:21 PM7/16/10
to scintilla...@googlegroups.com
This is now integrated but due to changes in the C++ lexer it looks
quite different:

>hg diff
diff -r e53b2cf7ef3f lexers/LexCPP.cxx
--- a/lexers/LexCPP.cxx Sat Jul 17 10:19:32 2010 +1000
+++ b/lexers/LexCPP.cxx Sat Jul 17 10:25:37 2010 +1000
@@ -189,6 +189,7 @@
bool trackPreprocessor;
bool updatePreprocessor;
bool foldComment;
+ bool foldCommentExplicit;
bool foldPreprocessor;
bool foldCompact;
bool foldAtElse;
@@ -198,6 +199,7 @@
trackPreprocessor = true;
updatePreprocessor = true;
foldComment = false;
+ foldCommentExplicit = true;
foldPreprocessor = false;
foldCompact = false;
foldAtElse = false;
@@ -234,6 +236,9 @@
"Explicit fold points allows adding extra folding by placing a //{
comment at the start and a //} "
"at the end of a section that should fold.");

+ DefineProperty("fold.cpp.comment.explicit", &OptionsCPP::foldCommentExplicit,
+ "Set this property to 0 to disable folding explicit fold points
when fold.comment=1.");
+
DefineProperty("fold.preprocessor", &OptionsCPP::foldPreprocessor,
"This option enables folding preprocessor directives when using
the C++ lexer. "
"Includes C#'s explicit #region and #endregion folding directives.");
@@ -823,7 +828,7 @@
levelNext--;
}
}
- if (options.foldComment && (style == SCE_C_COMMENTLINE)) {
+ if (options.foldComment && options.foldCommentExplicit && (style ==
SCE_C_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {


Neil

Reply all
Reply to author
Forward
0 new messages