Categories


Popular topics

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.

Folded code indicators

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.

Folded code preview / tooltip

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.

Hiding last line of 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.

Collapsing and expanding code folding via keyboard

It is possible to expand and collapse folding sections with the keyboard. The following keyboard shortcuts are available with default settings:

  • Ctrl + + (numeric keypad) - Collapse all
    Collapses all folding sections in the file, including nested sub-sections as well.
  • Ctrl + * (numeric keypad) - Expand all
    Expands all folding sections in the file, including nested sub-sections as well.
  • Ctrl + - (numeric keypad) - Collapse current section
    Collapses the active line's folding section.

Extended folding functionality is available with a combination of keyboard and mouse:

  • Ctrl + left-click on a folding node in the margin to collapse (or expand) just that folding section, and all nested sub-sections within it.
  • Alt + left-click on a folding node in the margin to collapse (or expand) all folding sections in the file including all nested sub-sections.

Code folding settings

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.

MediaWiki spam blocked by CleanTalk.