Chris Kent (ckent@espeed.co.uk)
Defaults fold strings for each mode are set in the Configurable Folding section of the Plugin Options dialog. Fold strings are set for each buffer individually using Plugins->Configurable Fold Handler->Buffer Fold Strings.
Fold strings cannot be blank. If invalid strings are entered in the Plugin Options dialog then an error message is displayed and folding is disabled for the selected mode. The Buffer Fold Strings dialog will not allow invalid strings to be entered.
gnu.regexp
package is used for matching. Under Java 1.4 the
java.util.regex
package is used which supports a wider range
of regular expression syntax.
public|private|if|switch
. If there are any regular expression special characters in
the start or end strings then they'll need to be preceeded with a
backslash ('\') character otherwise the folding won't work as
anticipated. These characters include the following:
* . \ ? + | [ ] ( ) ^
<[^!/\?].*?[^/-]> </.*?>These only work properly if tags aren't broken across multiple lines.
For Java, C and C++ code the following are useful to fold on both brackets and range comments:
{|/\* }|\*/(Java 1.3)
\{|/\* \}|\*/(Java 1.4)
If the start or end fold string is a substring of the other then
normal folding will not work correctly. This can sometimes be
worked around using regualar expressions. For example to match
the strings Function
, End Function
the
following regular expressions would work (under Java 1.4):
(?<!End )Function End Function
The following versions are slightly more complete as they specify that the strings must be preceeded and followed by a word break (\b).
(?<!End )\bFunction\b \bEnd Function\b
If anyone has any other useful regular expressions or any default fold strings for any jEdit mode then please let me know and I'll include them.