Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: joubertdj on December 05, 2006, 03:15:00 pm

Title: Code Folding Bugs (Solved Again... and Again)
Post by: joubertdj on December 05, 2006, 03:15:00 pm
An interesting bug has occurred when I played around with code folding. It is not a major crash bug just maybe a visual/functional bug. Okay so I enabled all three code folding options (including Fold preprocessor commands) now I enabled this and enabled that code folding needs to fold everything at startup. Okay… exit and restart your project that even your header pre-processor (#ifndef _HEADER_H) is basically the only visible line( that and end of line) Now… go to settings and disable the Fold Pre-Processor tab in folding without opening up the folded _HEADER_H part… when you have done that (clicked OK) the two lines stil stay there and you can not go within the Pre-Processor part. Imaged attached.

(http://CBFoldBug.jpg)

PS. Using SVN Version of C::B with wxWidgets 2.6.3 + Pacthes

Can someone confirm this please?


[attachment deleted by admin]
Title: Re: Code Folding Bug (Solved?)
Post by: joubertdj on December 06, 2006, 02:57:53 pm
Okay... I think I have an idea how to fix this... I found the function that will fix everything after you changed your settings : void ToggleAllFolds(); (cbeditor.h) If I understand correctly... and my understanding is limited... this will fold everything that needs to be folded after you change your settings without keeping things folded without a way of accessing them?

Problem is where do I place this call after you pressed the "okay"?

Can some developer help me please so that I can test this?
Title: Re: Code Folding Bug (Solved?)
Post by: joubertdj on December 08, 2006, 11:09:01 am
Hmm...  :?

Okay so in editormanager.cpp line 273 to 279 one has to tell the code folding part that if you disabled a folding option and it is still folded, you first need to expand the folded part before you return to the editor... else the bug that you can't see your codes or expand it... (with the little plus button)

Does this make sense so far? Anybody?
Title: Re: Code Folding Bug (Solved?)
Post by: dje on December 08, 2006, 11:14:20 am
No, you're not alone  :)

In fact, I never use folding, that's why I didn't answer you before.

Your investigation looks interesting and I hope it will end with a C::B improvement !

Dje
Title: Re: Code Folding Bug (Solved!)
Post by: joubertdj on December 12, 2006, 08:29:50 am
 :D Yeah... bug fixed... :D

The delay was due to the fact that I am buying a house, my boss wants to squeeze every drop of company resource out of me before Friday, and my wife also needs some attention  :lol:

Okay so I clean my C::B, do a SVN update and do the change and then do the SVN patch right?

Title: Re: Code Folding Bug (Solved?)
Post by: joubertdj on December 12, 2006, 08:35:52 am
 :) Submitted as: Patch Nr.: 001715
Title: Re: Code Folding Bug (Solved)
Post by: joubertdj on December 12, 2006, 08:38:54 am
 :? Now to tackle the other code folding bugs...
Title: Re: Code Folding Bug (Solved?)
Post by: killerbot on December 12, 2006, 01:48:14 pm
:) Submitted as: Patch Nr.: 001715

nice work, patch will be applied shortly ;-)
Title: Re: Code Folding Bug (Solved)
Post by: joubertdj on December 12, 2006, 02:37:26 pm
 :D Another Patch for other Code Folding Bug Nr 006965. Patch Number: 001716  :D
Title: Re: Code Folding Bug (Solved)
Post by: killerbot on December 12, 2006, 02:48:32 pm
there's a side effect :

consider this as the contents of a header file :
Code
#ifndef _NETSAL_H_INCLUDED_
#define _NETSAL_H_INCLUDED_

namespace ns
{

class CTest
{
  CTest();
};

} // namespace ns
#endif // _NETSAL_H_INCLUDED_

When it was initially not folded at all, and I turn on the fold of the preprocessor, then when I return to my editor, it is folded.
Not good : I allowed preprocessor stuff also to be folded, but it shouldn't be done automatically.

So now that my entire header is folded, let's continue the test : Back to the options and untick the preprocessor folding. Now when I arrive back in my editor, the preprocessor stuff is no longer folded (good) BUT in my example the namespace is folded --> NOT good.
Title: Re: Code Folding Bug (Solved)
Post by: joubertdj on December 12, 2006, 02:50:41 pm
 :? The problem that I am experiencing is that Scintilla does not "remember" what was where, and which one is a comment fold, and which one is a xml, html, or other fold...

EDIT: So I only unfold all... and fold them after the Style change...

EDIT: Should I write a a fixed proc for each foldable part (3 in total?)
Title: Re: Code Folding Bug (Solved)
Post by: killerbot on December 12, 2006, 03:01:41 pm
well I think , sticking to the current bug you mentioned at the beginning of this post.
Some folding is on (eg preprocessor) and then you turn it off =--> then only that specific folding that was turned off should unfold all it's folded instances.

When you turn on a folding, nothing should happen automatically, it will just allow a new type of folding.
Title: Re: Code Folding Bug (Solved)
Post by: joubertdj on December 12, 2006, 03:04:41 pm
Okay... so back to the whole API freeze thing... if I add then three procedures, one for each option within the folding options ... will that be okay?
Title: Re: Code Folding Bug (Solved)
Post by: killerbot on December 12, 2006, 03:07:56 pm
on 1 method with parameter : enum values which could be combined by or-ing them ??

[edit] : give it a try and we will look at it ;-)
[edit] : keep in mind that you discovered a nasty bug, which can be work around by closing and opening the file again, but it might scare the users to see that their header has shrun to 1 line ...
Title: Re: Code Folding Bug (Solved)
Post by: joubertdj on December 12, 2006, 03:09:20 pm
Sounds good, let met see what I can do with it...

[edit] : true... but how many times will you be changing the code folding settings anyway... ?
Title: Re: Code Folding Bug (Solved:?)
Post by: joubertdj on December 12, 2006, 03:55:26 pm
 :x I have trouble determining if the line is a pre-processor, comment, or xml...
Title: Re: Code Folding Bug (Solved:?)
Post by: joubertdj on December 13, 2006, 12:04:19 pm
 :? Scintilla bug... bug report filed at Scinitilla...

PS the other bug fix I posted actually works...

EDIT: Working for a hack around the scintilla bug...
Title: Re: Code Folding Bug (Solved Again ...)
Post by: joubertdj on December 13, 2006, 08:49:02 pm
Hey killerbot... I am not currently at my home pc... so here is the solution... sorry it is not in patch format... will only be able to get it to you by the end of tommorrow in patch format...

[attachment deleted by admin]
Title: Re: Code Folding Bug (Solved:?)
Post by: killerbot on December 13, 2006, 08:52:58 pm
no problem, I will try to take a look at it tomorrow, otherwise it will be for sunday.

[EDIT] : you can update your patch with this new code, and I will apply it then together with your other patch concerning folding. Should be able to apply it to my work copy at work and see how it behaves friday morning. So maybe i can already path then friday afternoon ...
Title: Re: Code Folding Bug (Solved:?)
Post by: joubertdj on December 14, 2006, 07:10:04 am
 :) Patch Uploaded...

Lets hope this one does the trick...
The patch includes the other patch of code folding and the limited amount of tests that I ran worked fine...

Patch number: 001715
Title: Re: Code Folding Bug (Solved:?)
Post by: joubertdj on December 14, 2006, 07:38:57 am
Question about a new Code Folding deletion bug number: 009380

If you read about the comments at berlios. Do you want this to delete the whole hidden part, or just delete the one line and unhide the others?

Dawie

[EDIT]... Not even sure it is fixable (Scintilla?) ... but hey ... will check
Title: Re: Code Folding Bug (Solved:?)
Post by: killerbot on December 15, 2006, 10:10:33 am
:) Patch Uploaded...

Lets hope this one does the trick...
The patch includes the other patch of code folding and the limited amount of tests that I ran worked fine...

Patch number: 001715

applied : good work !!!
Title: Re: Code Folding Deletion Bugs (Solved Again... and Again)
Post by: joubertdj on January 05, 2007, 12:34:48 pm
Code Folding Deletion Bug uploaded:
PatchNr: 1801

http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1801&group_id=5358 (http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1801&group_id=5358)

 :) Oh yeah... will be here now for the other patches' support :)