Bug folding feature in Editor ?

Working on new editor enhancements?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Bug folding feature in Editor ?

Post by Psychophanta »

Code: Select all

Macro tro()
  Enumeration
    #a
    #b
  EndEnumeration
  Structure aaa
    a.l
    b.f
  EndStructure
  DataSection
  Data$ "hi"
  EndDataSection
EndMacro
Here the DataSection block, the Structure block and the Enumeration one are not folded with folding feature enabled.
But sometimes when editing they appear folded. :roll:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
freak
PureBasic Team
PureBasic Team
Posts: 5941
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

No folding inside macros. It is by design, not a bug.
quidquid Latine dictum sit altum videtur
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

No, Psychophanta is right: Folding with Macros is definetyl buggy!

I added a folding option at the IDE preferences; now I can fold Macros as esayly as Procedures. But sometimes, the folding-line does not go from Macro till the line containing 'EndMacro', but it goes till the next folding-keyword or till the end of the document.

To geet rid of this bug, I always save my work and re-start the IDE.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

freak wrote:No folding inside macros. It is by design, not a bug.
Actually he said that problem was that they was folded even though they were inside the macro.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

I already understand, trond. But "my" bug also occurs, when not nesting folding keywords.
In other words: Although I don't fold inside macros, this bug appears.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Now, I can show you, what I mean:
Image
Picture, showing that macro-folding is buggy © AND51


This problem only occurs with macros - procedures, ;{, ;}, Enumeration, EndEnumeration... They are all good to fold, no problems...
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

freak wrote:No folding inside macros. It is by design, not a bug.
Fr34k, can explain a little "why" for that answer?
I find no reason to avoid folding inside macros and not inside procedures for example.
Mmm, you have most times a quick answer. Remember when discussing about paragraph alignment in editor, you answered there was no solution for it, but finally you solved it... :wink:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
freak
PureBasic Team
PureBasic Team
Posts: 5941
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Psychophanta:
Macros can contain very weird constructs that would screw up the folding of the entire document.
For example you could have a macro that only contains fold start words, but no end words. This
fold point would stay open for the entire document, because there is no end word.
Thats why it was disabled.


AND51:
You have to tell me how to reproduce it, or i can do nothing.
Your nice copyrighted image is of no help. ;)
quidquid Latine dictum sit altum videtur
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

In this special case the procedure SetLanguage() existed before creating/editing the macro.
I just edited/inserted the macro Language(); when finishing the macro by typing EndMacro in line 3 the folding-line in line 4 did not disappear.
If I now collapse (fold) the macro by clicking on the [-] in line 1, the next procedure also disapperas.

Furthermore, this bug sometimes occurs, when writing code from top to bottom. Means, first I create the macro, then creating the procedure, it looks like in my picture.

My computer is brand new, I also installed PB and PB IDE new incl. Update 4.01. So I conclude that it's not my computer's fault. Moreover, this bug also occured in eralier PB version 4.00 (since macros exist).
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

freak wrote:Psychophanta:
Macros can contain very weird constructs that would screw up the folding of the entire document.
For example you could have a macro that only contains fold start words, but no end words. This
fold point would stay open for the entire document, because there is no end word.
Thats why it was disabled.
Again, if that is the excuse, then take a look at this and see yourself the incoherence of that explanation:

Code: Select all

Procedure tro() 
  Enumeration 
    #a 
    #b 
  EndEnumeration 
  Structure aaa 
    a.l 
    b.f 
  EndStructure 
  DataSection 
  Data$ "hi" 
  EndDataSection 
EndProcedure
Here the folding works as it must. :wink:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Psychophanta wrote:Here the folding works as it must. :wink:
Of course.
For each fold start word there is a fold end word (and in the correct order), wich may not be the case in a macro.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

gnozal wrote:For each fold start word there is a fold end word (and in the correct order), wich may not be the case in a macro.
Well, i see the point. :) Then there is a small bug because while editing inside the macro (see the first post), folding appears and dissappears.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

freak wrote: AND51:
You have to tell me how to reproduce it, or i can do nothing.
Your nice copyrighted image is of no help. ;)
That happens all the time here, I should be able to give you a step-by-step guide later, but now I'm not at home.

Edit: AND51: Have you found the secret F12 key? You don't have to restart the entire IDE.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

There is a problem with the Macro folding. It is not serious, just double take stuff. It may be cosmetic or a redraw thing.

Open a new document.
Type Macro hit enter
Type anything hit enter
Type EndMacro hit enter
Arrow up to the top, so the cursor is before the Macro
Hit enter a few times. You have an orphaned [-]
Hit backspace. You get the vertical folding line extend beyond the EndMacro.

The above happens almost 100% of the time here. I would say 100% but I may be lying. Very Often is accurate.


There is another problem, often but not always. In a document with code, scroll back towards the top.
Type Macro Name(par,whatever) hit enter.
Vertical Line extends down to EndMacro of macro below, or just extends (this is not the bug)
Type gobblydegook or something, hit enter.
Type EndMacro, hit enter. This EndMacro is not recognised, or is not shown to be recognised (no little horizontal line and the vertical still plunges down)

The above happens quite often. Not always. And clicking the [-] does not fold the macro, so this may not be cosmetic.

Not sure because ..

Have another document loaded. Hit the tab for the second doc so the original is hidden. Hit the tab for the original doc. Viola. All looks good. Click [-] and [+] to fold/unfold at will.


So maybe just a redraw thing?
Dare2 cut down to size
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Trond wrote:Edit: AND51: Have you found the secret F12 key? You don't have to restart the entire IDE.
Hey, thanks a lot! I should "learn" the default hotkeys by hard... I just remember those, I use regularyly, but F12, for example, I don't use regularyly.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Post Reply