Code Folding

Previous topic - Next topic


This is great Gernot, thank you, a feature a lot of us have been after for a long time and now its here!  :enc:

P.S. As in the way of a hint, it works best by double clicking on the border of the line BELOW the function command.


"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)


Quote from: bigsofty on 2010-Mar-26
This is great Gernot, thank you, a feature a lot of us have been after for a long time and now its here!  :enc:

WooHoo!!   :nw:


i know code folding is painfully to implement so i must say a big thx gernot


Gernot did mention something like the second problem in the chat room.

I dont see the extra line being added though


thanks a loooot :nw:


Quoteevery time I fold a function and then unfold it, an additional empty line is created.
Weird!  :blink:


really? Works perfectly for me without additional blank lines.



Bing ChatGpt is pretty smart :O

Ian Price

Yeah the unfolding confounded me for a second - I was expecting a to double click the green box again to unfold.
I came. I saw. I played.


 :happy:  :nw:
*does a little happy dance*

Any chance of extending it to DATA blocks too?

Quote from: Ian Price on 2010-Mar-28
Yeah the unfolding confounded me for a second - I was expecting a to double click the green box again to unfold.

Me too. Gernot has said in the past how painful it was going to be to implement so I'm going to leave my requests to change the look-and-feel until some time down the track... :D

Doing a find for text in a folded section doesn't work too well - I just did a search for some text and it put the cursor on my folded function line at X position 2917.

And breakpoints are lost on folding too :(

Is there a fold-all/unfold-all somewhere?

Kitty Hello

I'll add an unfold all function!! Totally forgot that.
The background, and why I was able to make this fast and half-way working is:
- I snip the folded block out, and replace all "\r\n" with "\b\f" escape characters. The new precompiler can take care of that. If not, bug :S
Then, I have an indicator if that line is folded or not and if so, I just display "[...]" instead of the text.

That way I could get the editor "working" (not crashing) properly throughout all functionality (also load/save works).

The search is a slight problem, yes. But at least you get informed that it's in the block :D. I'll remove folded blocks from the search then to keep it consistent.


I know folding is not easy from what you've said, but I'll put my wish list anyway. Regardless, the current functionality is really appreciated so hopefully it doesn't come across as a series of complaints after all your hard work getting folding in there!  :)

* a "fold all" function as well as an "unfold all" (accessible from the right mouse click menu perhaps?)

* Replace the green square in the left hand column (indicating a function) with a [ - ] or [ + ] symbol/button to fold/unfold the function. It makes it obvious then that you can fold/unfold the function and how to do it - see

* If I read what you've written correctly, you're planning on ignoring the contents of folded functions when searching. I would much rather see it automatically unfold functions (when the text is found in that folded function). Having it skip folded blocks is not good! I would rather have it work how it currently does than ignore code.

* Custom fold blocks (in other IDE's it's done by a special comment text - e.g. //FOLDSTART and //FOLDEND - the IDE knows to not show those special comment lines and to draw the [...] instead) - available by selecting the text then through an option on the right button menu.

* Preserve breakpoints - maybe don't allow functions with breakpoints to be folded if you can't preserve them and fold the function

* Make data blocks foldable without needing to do a custom block as requested above


sorry, it has been a while, but I just had to come around and say thanks for this feature, it is really important for me, really, I'm not an advanced programmer but I strive to get my things done, this helps a lot. Thanks! Thanks!


You know what would be nice?  Comment goto's that only effect the jump list.  I put little goto like "topcode:" and "midcode:" and so on to make navigation through code easier.  Can we have a commented out version that is just for navigation and not used in-code?

Hope I explained this right.
Current Project, Orbital Contract Defense

BlackShadow now open source/resource(requires duke3d)