Fold boxes show the structure of the source code graphically. Up to now fold boxes are implemented for C/C++ (and similar) files only. When fold boxes are switched on, Scintilla will draw boxes around code belonging together following the level of braces. As fold boxes are just an enhancement of the folding facility of SciTE/Scintilla you must insert
fold = 1
in the property file to get fold boxes. The value 1 in the fold.flags switches the fold boxes on. The usage of
fold.flags=17
in the property file will show boxes if the fold is expanded and a line below every contracted fold. If you use SciTE.exe you can use the View / Fold Boxes menu topic to switch on and off the display of fold boxes.
Fold boxes begin at an opening brace { is encountered or if fold box keywords are found. If one of the keywords is found the program searches backward and draws the box header line above of all comments and empty lines before this keyword (assuming that these comments belong to the code below).
Fold boxes may be persistent, i.e. the boxes are closed at file open time if the fold.on.open flag is set and these folds are additionally marked with //+ or /*+*/ etc.
fold.on.open=1
The keywords for fold headers and for persistent folds are determined in the property file by keywords4.
keywords4.$(file.patterns.cpp)=1:case 1:do 1:for 1:if 1:switch 1:while 1:/*-- 1://-- 1:/*{- 1:/*{+ 1://{+ \
2://++ 2:/*+*/ 2:/*{+ 2:/*{+ 2://{+
Keywords preceded with 1: define the keywords for fold box header lines. The keywords preceded with 2: mark the persistent folds.
The more or less undocumented fold.flags are used to define fold boxes. This is done as there exists a scintilla command for setting the fold flags. The main job is done in LexCPP.cxx where the fold box flags are added to the fold level. The folding function has been split into two functions FoldBoxCppDoc (with boxes) and FoldNoBoxCppDoc (without boxes). This doubles some code but lowers the complexity of the function.
In Editor.cxx the method Editor::Paint() has been changed to draw the fold box lines. Here the logic has also been split into two paths: one for fold lines without boxes, one for fold lines with boxes. The same again: the code complexity is quite high.
There seem to be some performance problems when opening a file like Editor.cxx. I hope that these problems are not produced by the fold lexer function.