#210 Fold on #else in C?


Hi, and tanks for your very good job on SciTe ;o)

1) Is there a way to put Fold on preprocessor directive
such as #else in C. It works fine on #if, #ifdef but
not on #else, or #elif. I try fold.at.else=1 but no
fold on #else ???

2) May be is it possible to also implement the
"Selective Display" as CodeWright do (show line code
only for any defined constant)
For example this code:

#ifdef CONST_01
// Stuff here if CONST_01 is defined ...
// Stuff here if CONST_01 is NOT defined ...

...other stuff...

So if i define CONST_01 in the same file or in another
file in my C project as:
#define CONST_01

Then the code automatically looks like:
+// Stuff here if CONST_01 is defined ...

...other stuff...

Otherwise if CONST_01 is not defined then the code
automatically looks like:
+// Stuff here if CONST_01 is NOT defined ...

...other stuff...

Best Regards.



  • Neil Hodgson

    Neil Hodgson - 2005-04-11
    • priority: 5 --> 2
    • assigned_to: nobody --> nyamatongwe
  • Neil Hodgson

    Neil Hodgson - 2005-04-11

    Logged In: YES

    1) is not currently supported. 2) requires a large amount of
    code to understand the preprocessor lines. I have done some
    work on this for a related feature in SinkWorld but won't be
    working on this for Scintilla.

  • Alexey Denisov

    Alexey Denisov - 2016-08-27

    Hi to everyone. I made a little patch that adds folding support for #else and #elif preprocessor clauses. It is disabled by default, but can be enabled by setting fold.cpp.preprocessor.at.else option to 1. The patch is based on SciTE 3.6.6 release source code from Scintilla website.
    I didn't find any contribution guidelines, so just putting it here.

    As 2) seems to be implemented in current code base, I think this issue can be closed if patch is accepted.

  • Neil Hodgson

    Neil Hodgson - 2016-08-28

    With this patch, fold.cpp.preprocessor.at.else has no effect unless fold.at.else is also set. Either the relationship should be made explicit in the DefineProperty for fold.cpp.preprocessor.at.else or the two properties should be truly independent.

  • Neil Hodgson

    Neil Hodgson - 2016-08-30
    • labels: --> scintilla, lexer, cpp
    • Group: --> Committed
  • Neil Hodgson

    Neil Hodgson - 2016-09-05
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks