Author Topic: Folding level patch  (Read 6301 times)

Offline XayC

  • Multiple posting newcomer
  • *
  • Posts: 94
Folding level patch
« 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).

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]

Offline XayC

  • Multiple posting newcomer
  • *
  • Posts: 94
Re: Folding level patch
« Reply #1 on: November 08, 2007, 04:43:27 pm »
I've submitted the patch, here.

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: Folding level patch
« Reply #2 on: November 08, 2007, 09:22:55 pm »
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.
« Last Edit: November 08, 2007, 09:25:02 pm by JGM »

Offline kkez

  • Almost regular
  • **
  • Posts: 153
    • WinapiZone
Re: Folding level patch
« Reply #3 on: November 13, 2007, 03:22:00 pm »
@developers: Please submit this patch, mcdave did already try to make one  but it wasn't submitted in time. It's useful for me, hope it doesn't get rejected like the first.

Offline Barking_Mad

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Folding level patch
« Reply #4 on: November 14, 2007, 09:46:00 am »
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 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.
WooF! WooF! - Ubuntu 8.10 & CB 5432 & GCC 4.3.2
To see the world in a grain of sand and heaven in a wild flower
To hold infinity in the palm of your hand and eternity in an hour - W.B