Author Topic: New Folding Issue  (Read 14443 times)

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
New Folding Issue
« on: July 21, 2006, 03:32:11 am »

I'm looking through some code that has lots of

typedef struct
{
    int member;
}struct_name;

blocks in it. When it opens it all folds by default, and none of the struct names can be seen.  :?
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline PhyloGenesis

  • Multiple posting newcomer
  • *
  • Posts: 10
  • PhyloGenesis
Re: New Folding Issue
« Reply #1 on: July 21, 2006, 09:46:19 am »
goto Editor options, the folding tab, and deselect the option to fold all on load
PhyloGenesis

"For every programmer, there is an equal and opposite programmer who can't stand to read the first programmers code." - Snook's first law of (game) programming

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: New Folding Issue
« Reply #2 on: July 21, 2006, 08:35:19 pm »
goto Editor options, the folding tab, and deselect the option to fold all on load
  :lol: That's not the problem. I want everything to be folded. The problem is being unable to see what the structs are.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline PhyloGenesis

  • Multiple posting newcomer
  • *
  • Posts: 10
  • PhyloGenesis
Re: New Folding Issue
« Reply #3 on: July 22, 2006, 12:05:00 am »
We'll I was going to put it in as a feature request that when they fold, they don't fold the closing bracket.
My reason was that when if statements are folded, it looks like the next statement (after the close) is part of the if, but your reason makes sense to.

Oh, and for me, even though I have the option on, nothing is folded when I open files...
« Last Edit: July 22, 2006, 12:07:00 am by PhyloGenesis »
PhyloGenesis

"For every programmer, there is an equal and opposite programmer who can't stand to read the first programmers code." - Snook's first law of (game) programming

Offline kidmosey

  • Multiple posting newcomer
  • *
  • Posts: 95
    • MUSITU International
Re: New Folding Issue
« Reply #4 on: July 22, 2006, 01:59:45 am »
It might be tedious, but you could try updating all the structs to the following format:

Code
typedef struct _struct_name
{
    int member;
} struct_name;

That way, the struct has a name and the typedef has a name.  I believe this is the standard way of defining typedef structs, anyhow.
3 years until google knows more than god.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5514
Re: New Folding Issue
« Reply #5 on: July 22, 2006, 11:38:41 am »
well it depends, that typedef stuff comes from C.

In the C++ world you don't do that:

struct MyStruct
{
  // ...
}

and you can use the struct

just like you do with a class :

class MyClass
{
}

In C++ in neither cases you need that typedef, so it is preferred NOT to use it.

The typedefs CAN have an added value if you use STL containers, because then they can hide the actual type (for the container and it's iterators, so you can easli switch them). But as far as those iterators will be concerned in TR1 the type will be determined automatically.

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: New Folding Issue
« Reply #6 on: July 22, 2006, 11:36:11 pm »
The code is not mine to change. I was looking through some example source files. Lots of code is written like this, wether it is right or wrong form is a matter of personal preference, and doesn't change the fact that it's an issue with the feature.

I also think like the above poster, that the last brace should be visible.
« Last Edit: July 22, 2006, 11:39:46 pm by Vampyre_Dark »
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

sethjackson

  • Guest
Re: New Folding Issue
« Reply #7 on: July 23, 2006, 02:33:51 am »
The code is not mine to change. I was looking through some example source files. Lots of code is written like this, wether it is right or wrong form is a matter of personal preference, and doesn't change the fact that it's an issue with the feature.

I also think like the above poster, that the last brace should be visible.

Yup it's a bug. However I don't know how to fix. :P

Yeah I agree with PhyloGenesis. I get confused sometimes when I use the folding stuff.
« Last Edit: July 23, 2006, 02:56:59 am by sethjackson »

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: New Folding Issue
« Reply #8 on: July 23, 2006, 02:48:24 am »
The AStyle plugin has nothing to do with folding... or did I miss something? :?

sethjackson

  • Guest
Re: New Folding Issue
« Reply #9 on: July 23, 2006, 02:56:40 am »
The AStyle plugin has nothing to do with folding... or did I miss something? :?

Why did I say that.  :oops:  :P

Offline kidmosey

  • Multiple posting newcomer
  • *
  • Posts: 95
    • MUSITU International
Re: New Folding Issue
« Reply #10 on: July 23, 2006, 05:16:31 am »
I also think like the above poster, that the last brace should be visible.

But then the fold could take upto 3 lines, two of which would usually be blank (except for braces).

Code
+ class CDolphin: public fish
  { // A dolphin class
  };
-------------------------------------------------------

+ struct TShark
  {
  };
-------------------------------------------------------

At first glance, they just look like empty declarations.  Personally, I think both braces should be left out.  At any rate, I'm not sure if this is a C::B issue or a scintilla issue.
3 years until google knows more than god.

Offline PhyloGenesis

  • Multiple posting newcomer
  • *
  • Posts: 10
  • PhyloGenesis
Re: New Folding Issue
« Reply #11 on: July 23, 2006, 09:28:20 am »
>At first glance, they just look like empty declarations.

? No, it should look like this (the line would go where the missing code is).

Code: cpp
+ class CDolphin: public fish
  { // A dolphin class
-------------------------------------------------------
  };

+ struct TShark
  {
-------------------------------------------------------
  };

Where is the source code for the folding?  (I'll check it out.)
« Last Edit: July 23, 2006, 09:33:59 am by PhyloGenesis »
PhyloGenesis

"For every programmer, there is an equal and opposite programmer who can't stand to read the first programmers code." - Snook's first law of (game) programming

Offline kidmosey

  • Multiple posting newcomer
  • *
  • Posts: 95
    • MUSITU International
Re: New Folding Issue
« Reply #12 on: July 23, 2006, 10:19:02 am »
No, it should look like this (the line would go where the missing code is).

Code: cpp
+ class CDolphin: public fish
  { // A dolphin class
-------------------------------------------------------
  };

+ struct TShark
  {
-------------------------------------------------------
  };

Ahhhh, okay... Yeah, that makes a bit more sense.

Where is the source code for the folding?  (I'll check it out.)

I did a quick search in SVN.

file: /src/sdk/cbeditor.cpp
line: 1290

I'd start there.
3 years until google knows more than god.

sethjackson

  • Guest
Re: New Folding Issue
« Reply #13 on: July 23, 2006, 02:30:24 pm »
No, it should look like this (the line would go where the missing code is).

Code: cpp
+ class CDolphin: public fish
  { // A dolphin class
-------------------------------------------------------
  };

+ struct TShark
  {
-------------------------------------------------------
  };

Ahhhh, okay... Yeah, that makes a bit more sense.

Where is the source code for the folding?  (I'll check it out.)

I did a quick search in SVN.

file: /src/sdk/cbeditor.cpp
line: 1290

I'd start there.


You may want to check out the wxScintilla sources too.......

Offline PhyloGenesis

  • Multiple posting newcomer
  • *
  • Posts: 10
  • PhyloGenesis
Re: New Folding Issue
« Reply #14 on: July 24, 2006, 09:19:15 am »
If any of the developers are willing:
To change the folding feature to not fold the closing brace simply


File: /src/sdk/cbeditor.cpp
Line: 1280-1284

change:
if (expand)
  m_pControl->ShowLines(line + 1, maxLine);
else
  m_pControl->HideLines(line + 1, maxLine);

to:  (just remove the " + 1")
if (expand)
  m_pControl->ShowLines(line, maxLine);
else
  m_pControl->HideLines(line, maxLine);


If there are residual problems, (such as the folder no longer finds the close brace) let me know, I'll do a more detailed check and get back on how to do it.
PhyloGenesis

"For every programmer, there is an equal and opposite programmer who can't stand to read the first programmers code." - Snook's first law of (game) programming