Code Folding

Code folding, implemented in UltraEdit v11.00 and UEStudio, works in conjunction with the Hide/Show Lines feature of previous versions.

There are two configuration options under the Code Folding branch under Configuration in the Advanced menu that determine whether or not code folding and hiding/showing lines is supported in UltraEdit: Enable show/hide lines and code folding and Enable show/hide lines for non syntax highlighted files.

Enable show/hide lines and code folding

If this option is selected under Configuration then the Hide/Show Lines command may be invoked via the View menu option. Selection of this configuration option also enables code folding and a small gutter will be visible between the line numbers and the edit window where the symbols used for code folding ("+" and "-") will be displayed. By default code folding will operate on any strings (whether characters - "{, }" - or words - "if,
endif") defined in the active wordfile as /Open Fold Strings or /Close Fold Strings. Please see Syntax Highlighting for further information on fold strings.

If a "+" or "-" is displayed in the folding gutter the folding state of the referenced code may be toggled by left-clicking on the folding symbol in the folding gutter. For example, in the following code:

clicking on the "+" would expand the collapsed code. Clicking on the "-" below:

would collapse the expanded code.

There are two code folding options that may be selected from the View menu: Expand All and Collapse All.

Expand All

When this command is invoked from the View menu, all blocks in the active file bounded by Indent/Unindent Strings defined in the active wordfile would be expanded. If text is selected this will affect only the selected region. If no text is selected this command will operate on the whole of the active file.

Please note: When this command is invoked, strings hidden using the Hide Lines command will be expanded as well as folded sections of code.

Collapse All

When this command is invoked from the View menu, all blocks in the active file bounded by the Indent/Unindent Strings defined in the active wordfile would be collapsed. If text is selected this will affect only the selected region. If no text is selected this command will operate on the whole of the active file.

Enable show/hide lines for non syntax highlighted files

If this option is selected under Configuration then the Hide/Show Lines command may be invoked via the View menu option even on files that have no syntax highlighting (e.g. on standard text files). The advantage here is that lines that have been hidden using the Hide/Show Lines command will be indicated by the "+" in the folding gutter. If this option is not selected under Configuration, text may not be hidden in non-highlighted files and the folding gutter will not be displayed.