Close fold with end of text

Syntax highlighting, code folding, brace matching, code indenting, and function list

Close fold with end of text

Postby Pete » Tue Sep 05, 2006 2:53 pm

Hi,

Can anyone show me how to set the end of text to close a fold?

Maybe it's the wrong question but what I'm trying to do is fold by a header eg

[section1]

code..1

[section2]

code..2

if i set open fold to "[" and close fold to "[" this works except for the last section? Is there a better way perhaps?

Thanks,

Cheers,

Pete
User avatar
Pete
Newbie
 
Posts: 6
Joined: Wed Jun 07, 2006 11:00 pm

Re: Close fold with end of text

Postby Mofi » Tue Sep 05, 2006 4:19 pm

That's not possible. This is the disadvantage of identical open and close fold strings. The last section is not recognized by the code folding engine as foldable section.

You have to fold it manually by selecting the whole last section and use View - Hide/Show Lines - Hide/Show Selection. This can be automatically done on file open with a macro if you really need it often and don't save the current folds for the current file on exit.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Close fold with end of text

Postby Pete » Tue Sep 05, 2006 5:58 pm

Hi Mofi,

Thanks for reply!

I can do a macro to select and collapse but as this loses the fold point '-' I guess I need to run the macro each time I want to collapse the code. I might also just have a dummy section at the end..?

This leads onto related (?) questions -

Can you use regular expressions in the fold, indent strings and keywords?
I would like to (for example) apply different meanings to '[' depending on whether it is at the beginning of a line or for ']' whether it has an '=' after or not.

Is there a priority in the syntax highlighting be it function, indent or fold string?

Cheers,

pete
User avatar
Pete
Newbie
 
Posts: 6
Joined: Wed Jun 07, 2006 11:00 pm

Re: Close fold with end of text

Postby Mofi » Wed Sep 06, 2006 6:03 am

Regular expressions can only be used for function, member and variable strings. Member and variable strings are only supported by UEStudio. For everything else only simple words, not terms/phrases, can be used.

/Ignore Fold Strings = "..."
/Open Comment Fold Strings = "..."
/Close Comment Fold Strings = "..."

could be helpful too.

There is no priority. A keyword can be also an indent and a fold string. For C/C++ for example this is true for { } .
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Close fold with end of text

Postby Pete » Wed Sep 06, 2006 6:40 am

Many thanks Mofi,

judicious use of a range of ignore fold strings results in exactly what I want.

Cheers,

Pete
User avatar
Pete
Newbie
 
Posts: 6
Joined: Wed Jun 07, 2006 11:00 pm


Return to Syntax Highlighting