Can nedit have a tree collapse/expand view of C/C++ code?

Tony Balinski ajbj at free.fr
Wed Oct 4 10:32:07 CEST 2006


Quoting Thorsten Haude <yoo at vranx.de>:

> Hi,
>
> * GuoQing Hu wrote (2006-10-03 17:20):
> >I am new to this discuss group. Maybe this kind of
> >question is already posted by other people.
>
> Yes, it was.
>
>
> >Since I use nedit a lot. It will be great if
> >nedit can view C/C++ in a tree collapse/expand format.
>
> That's not possible in the moment, though there is a collection of
> macros doing something like this for Twikis, and some guys are working
> on a full folding patch.

You can use these ancient macros for "folding" too:
  http://www.mailnet.co.uk/~marc/msl.html#45
The idea is that they collapse multiple lines to a single line by
substituting the newlines with vertical tabs; if you have a selection, it
will be collapsed; if your cursor is on a matchable character (paren,
bracket or brace) that gets collapsed. It also allows for custom fold
comments. The whole collapsed area has start and end marks added
(formfeed and three brackets) so that the collapsing can nest. By adding
some syntax highlighting for the start and end sequences, you can make
the collapsed text well-nigh invisible so it doesn't get in the way
visually.

The problem is that this is not a true fold: the text is still there, your
cursor still moves across it, and if you have continuous wrap on, you see
the collapsed line at its full length (even if your syntax highlighting
has made the text hard to read). It also modifies the text, something
true folding must not do.

It's fairly rare that I need folding, but when I do, these macros help.
If I were working with more heavily nested languages (standard Pascal
springs to mind) I would probably use them more.

Tony


More information about the Discuss mailing list