[Lazarus] Code Folding mess and Code Divider feature

Martin Friebe lazarus at mfriebe.de
Fri Mar 13 13:16:14 CET 2009


Graeme Geldenhuys wrote:
> Hi,
>
> This relates to the new bug report:
>   http://bugs.freepascal.org/view.php?id=13322
>
> Code Folding seems to have gone way overboard!  It simply makes the
> editor look like a mess at the moment (Lazarus svn trunk revision).
> What is the end goal of code folding? Maybe is in the middle of the
> overall goal and I am simply acting to quickly. Either way, I will
> voice my concerns...
>   
There is a general plan/idea to add some configuration (have to see how 
much) to define what you want to have foldable and what not. It wasn't 
seen as urgent yet (at least not by me...)

Most (if not all) of the places that allow folding now, do so in Delphi 
as well. this is part of why they have been added, to make it easier for 
(ex-) Delphi users.

IMHO most of the new ones are reasonable?
- Except maybe for: "Program" / "Unit" and "Implementation" / 
"interface"; but they don't occur very often in a normal unit.
- Maybe discussable are "var" "Canost" "type" blocks? Think is they can 
be very useful for bigger "var" sections (but I agree they can be 
irritating with just on line in it)
- Folding at class / private / public => IMHO should be ok?
- Folding at "procedure" in addition to the begin => arguable, if it 
should be instead of the begin?

Will be interested to see, if other people will voice opinions, which of 
the new foldings they like, which not....

> In older versions of Lazarus the Code Folding [+] was in logical
> places. begin..end blocks.   Now they appear on Implementation
> sections, uses classes, procedure/function level, begin..end block of
> procedure/function, begin..end block of if statements, var blocks
> etc...  You end up with code looking as follows (code folding plusses
> everywhere)!
>   
.....
> At the moment it is more like trying to spot a line of code that
> doesn't have a [+] in the gutter!!  This is just causing clutter and
> not actually adding any value as far as I can see. Especially now that
> the code folding lines and +/- signs are inside the editor code area
> and not the gutter area. OK, so we all know synedit now supports code
>   
You can change this:
The gutter divider line is moveable, and the code fold background color 
adjustable.
Only the code-folding is now on the right side  of the gutter (towards 
the text) rather than the left, as it used to be.

Enviroment=>options=>editor=>display=> "gutter separator index"
Enviroment=>options=>editor=>color=> "code folding tree" (3rd in box)

> folding, but we don't need it on every line.  Maybe Lazarus should
> have a Code Folding verbosity level going from 'Normal Code Folding'
> to 'Insane Code Folding'.
>
> This brings me to another point. Initially the Code Folding was not as
> verbose, so I tied the "Draw Code Divider" feature into the Code
> Folding feature. But now that Code Folding is so verbose it now makes
> no more sense and seems to get broken quite often.  Maybe the "draw
> code divider" should become a separate feature and not tied into the
> code folding. The idea of "draw code divider" was simply to draw a
> horizontal line at the end of each procedure or method (like visual
> basic 6 did). I have no interest in drawing horizontal divider lines
> wherever code folding can occur. And with the current verbose level of
> code folding and horizontal lines (if they work) you will actually
> struggle to see your code between the whole mess.
>   
That can be looked at / I can see the benefit of such a feature.

Not sure where it gets broken? Are the pictures from different versions 
of lazarus? or are they with different settings?

If you want then at begin/end level you need to set the divider draw 
level higher => the down side is, there will be additional dividers.
This may not be the effect you desire, but it is the effect intended.

Best Regards
Martin



More information about the Lazarus mailing list