Code::Blocks Forums
Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: XayC on October 30, 2007, 06:20:11 pm
-
Tired of having everything in my files folded (including deeply nested loops and things like that) I decided to add a folding level (depth) limiter (which is also probably what was requested here (http://developer.berlios.de/feature/index.php?func=detailfeature&feature_id=3295&group_id=5358)).
The changes simply allow the folding code to fold up to a specified depth. So for example setting the level to 1 (which is also the minimum) will only fold the main blocks. Settings are in the folding panel of the editor settings.
There's still a problem: in a C file with only functions you may want to set the level to 1, so only the functions are folded and everything inside is not; but in a C++ file it may be possible to want both the classes and the functions to be folded (so level 2). In general there's no easy way to detect the correct level nor set it to a value that can work for every kind of file.
The patch file containing the changes is attached. Patch tested to compile and work on both Linux and Windows.
XayC
[attachment deleted by admin]
-
I've submitted the patch, here (http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2235&group_id=5358).
-
it would be nice if codeblocks could remember the folds that we have done for each file. For example: store it on the layout file. I will check if that could be done.
-
@developers: Please submit this patch, mcdave did already try to make one (http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1810&group_id=5358) but it wasn't submitted in time. It's useful for me, hope it doesn't get rejected like the first.
-
You could have a fold priority value associated with each fold level, with users able to set their own priority to folding.
This could allow you to set folding for certain keywords on a by priority basis, for example for could be associated with a lower priority. Then the depth of folding would fold to a specific priority level/depth as opposed to some arbitrary level.
I recently submitted this Request (http://developer.berlios.de/feature/?func=detailfeature&feature_id=3838&group_id=5358) and this post caught my eye.
Looking at the src though, it seems the folding is irrespective of the context of the braces, in my mind the braces represent a context or grouping which should have association. Not given it much thought though.