Code folding refers to the ability to show and hide logical sections of text, usually in source code files, for the purposes of isolating and focusing on one or more portions of the text in the file. Like most editors, UltraEdit facilitates this with a code folding margin on the left side of the edit window, near the line numbers. This code folding margin contains graphical elements that allow you to expand and collapse sections of code. The ⊟
icon allows you to collapse a section of code, and the ⊞
icon allows you to expand a collapsed section of code.
In UltraEdit / UEStudio, a graphical vertical line is also drawn in the code folding margin from the opening fold icon down to the end point of the folding section to visually indicate the scope of the section and what text will be controlled by the folding nodes.
Automatic code folding for syntax highlighted source code files is controlled by code folding definitions in the wordfile. Syntax highlighting and code folding are applied automatically based upon the active file's extension matching the file extensions defined in the wordfile.
When a section of code is collapsed, its corresponding folding node in the code folding margin will change colors to indicate its collapsed state. Additionally, the background color of the actual line where the fold starts will change colors as well to indicate the fold. Both of these colors are theme-specific and can both be modified in the Manage themes dialog.
When a section of code or text is folded, UltraEdit / UEStudio will show a collapsed code icon at the end of the opening line of the fold. You can hover over this icon with the mouse to see a tool tip containing the text hidden by the fold. This allows you to "peek" at folded code without having to actually expand the folded code.
By default, the last line of folded code is shown. If you don't want the last line of the fold to be shown, you can uncheck Show last line of fold in syntax highlighted files under Settings » Editor display » Code folding.
It is possible to expand and collapse folding sections with the keyboard. The following keyboard shortcuts are available with default settings:
Extended folding functionality is available with a combination of keyboard and mouse:
Code folding is determined by the active highlighting language's wordfile. The wordfile contains "Open fold strings" and "Close fold strings" to determine what specific strings should open and close folds. You can modify these to suit your needs, although a reload of the file might be required for any changes here to take effect.
There are several options related to code folding functionality in Settings » Editor display » Code folding.