Code folding allows to collapse (hide) and expand certain parts of the document. These parts are called folds and they can be nested (fold can contain another fold). The fold can occupy more lines but it can be also just part of the one line. Folds are visualized in the document.
Code folds are created by editor depending on supported fold types for a particular source code. When a file is opened, all folds are identified and expanded by default, so the user can see the whole source code. However, he can define which fold types are collapsed when he opens a file.
Folding margin is placed next to the margin for annotations glyphs and line numbers. However, it is visible only in documents which have the code folding feature turned on.
It is used for displaying these signs:
- - appears at the first line of a collapsed fold
- - appears at the first line of an expanded fold
- - appears at the last line of an expanded fold
- vertical line - appears between and of an expanded fold
and can be clicked by mouse. Clicking on sign expands the fold. Clicking on collapses the fold.
If showing of the line numbers is activated and some fold is collapsed, line numbers ordering is changed accordingly.
There are two code folding options that may be selected from the Format menu: Expand All and Collapse All.
When this command is invoked from the Format menu, all blocks in the active file bounded by Indent/Unindent Strings defined in the active wordfile would be expanded.
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.