GLBasic forum

Main forum => GLBasic - en => Topic started by: bigsofty on 2010-Mar-26

Title: Code Folding
Post by: 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:

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.
Title: Re: Code Folding
Post by: Kuron on 2010-Mar-26
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:
Title: Re: Code Folding
Post by: Marmor on 2010-Mar-26
i know code folding is painfully to implement so i must say a big thx gernot
Title: Re: Code Folding
Post by: MrTAToad on 2010-Mar-26
Gernot did mention something like the second problem in the chat room.

I dont see the extra line being added though
Title: Re: Code Folding
Post by: erico on 2010-Mar-26
thanks a loooot :nw:
Title: Re: Code Folding
Post by: MrTAToad on 2010-Mar-26
Quoteevery time I fold a function and then unfold it, an additional empty line is created.
Weird!  :blink:
Title: Re: Code Folding
Post by: Quentin on 2010-Mar-28
really? Works perfectly for me without additional blank lines.
Title: Re: Code Folding
Post by: Marmor on 2010-Mar-28
same here
Title: Re: Code Folding
Post by: Hemlos on 2010-Mar-28
 :good:
Title: Re: Code Folding
Post by: 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.
Title: Re: Code Folding
Post by: FutureCow on 2010-Mar-29
 :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?
Title: Re: Code Folding
Post by: Kitty Hello on 2010-Apr-06
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.
Title: Re: Code Folding
Post by: FutureCow on 2010-Apr-07
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 http://www.fungamesfactory.com/screenshots/ideal5.png (http://www.fungamesfactory.com/screenshots/ideal5.png)

* 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
Title: Re: Code Folding
Post by: erico on 2010-Apr-17
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!
Title: Re: Code Folding
Post by: Scott_AW on 2010-Apr-17
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.
Title: Re: Code Folding
Post by: Moru on 2010-Apr-17
I'm using

SUB ___Section___:
ENDSUB

To get some sort of structure in the jumplist. As long as you don't sort the list this works fine for me at least.
Title: Re: Code Folding
Post by: Scott_AW on 2010-Apr-17
I could try that for categorizing up my functions and subs.