Okay, now I understand the problem. If a syntax highlighting language has a
Block Comment On/Off = definition in the first line, UltraEdit interprets everything between these 2 strings as a block comment. If such a block comment spans over multiple lines, UltraEdit offers automatically folding for such a block.
But UltraEdit does not interpret a sequence of line comments as a block for folding. That would be the feature you need. Well, such a feature would make sense not only for Korn shell and Bash, it would make also sense for many other script and programming languages. I will sent a feature request email to IDM support for such an enhancement. If you do the same, the "requested by user count" would be already 2.
The
Comment Fold Strings definition are for defining special strings right of a line comment string to be interpreted as start and end of a block to fold. That can be used for example for folding following C/C++ code
Code: Select all
#ifdef ___GNUC__ // DEFS_BEGIN for GNU C++ Compiler
// Lots of definitions for GNU C++ Compiler
#endif // DEFS_END for GNU C++ Compiler
#ifdef _MSC_VER // DEFS_BEGIN for Microsoft Visual C++ Compiler
// Lots of definitions for Microsoft Visual C++ Compiler
#endif // DEFS_END for Microsoft Visual C++ Compiler
with following definition in the wordfile
Code: Select all
/Open Comment Fold Strings = "DEFS_BEGIN"
/Close Comment Fold Strings = "DEFS_END"
The yet in UE v17.30 not available feature of interpreting a sequence of line comment lines with nothing or just spaces/tabs between start of a line and the line comment starting string on every line can be worked around by you by marking the begin and end of such a block with special strings. You can see what I mean in the modified files in the attached archive file.
A method to quickly fold a block of line comments is to use following macro with a hotkey assigned for fast execution and stored in a macro file automatically loaded on startup of UltraEdit.
Code: Select all
InsertMode
ColumnModeOff
HexOff
PerlReOn
IfColNumGt 1
GotoLine 0 1
EndIf
Find RegExp "^(?:#.*\r\n){2,}"
IfFound
HideShowSelection
EndIf
You can enhance the macro further or translate it to a script and enhance the script in case you want more like folding a sequence of line comment lines independent of current position within such a block.
Some more hints in case you compare your wordfile with the modified version in the attached archive file.
The regular expression search for function strings is always executed not case sensitive. Therefore [a-zA-Z] and [A-Z] are equal [a-z].
Regular expression
++ means preceding character or expression 0 or more times. A character set definition like
[ ] with only 1 character inside does not make much sense. In this case simple using just the space character without the square brackets is enough.
What
(^(^)) should be in the second function string is not really understandable for me.
^( and
^) are for marking what part of the found string should be displayed in the function list view. With nothing between and with the fact that there is already such a tagging group over left part of the expression, it does not make sense.
Your highlighting problem with
>& and
<& in comparison to just
& is caused by the fact that
<, and
>, and
& are defined as word delimiting characters. Therefore the syntax highlighting engine reads the string
>& as "word"
> and as "word"
& and highlight them accordingly.
If you have always spaces around
>,
>&,
>>,
<,
<&,
<<, and
&, you can remove
<, and
>, and
& from the list of delimiters and specify them all in C4 and C8 to get them highlighted as formatted here.