Menu

#1676 Some code not folded correctly

Bug
closed-invalid
3
2015-01-11
2014-12-29
Riot
No

When folding certain code (it seems to be related to braces in comments), the code sometimes fails to fold correctly.

The test code:
class Myclass {
myfunction1() {
//(){
//}
}

  // this should be folded
  myfunction2() {
  }
};

In Code::Blocks:

In Scite:

This seems like a minor issue with the reduced code above, but in a production codebase I'm working on this affects a large header, making it very diffucult to navigate. Additionally, I've had an issue that's probably related where, after folding and unfolding, some lines of code disappear until the file is closed and reopened. Obviously this can cause quite serious programming errors. Unfortunately I haven't been able to reliably replicate that one, although it did once happen with a variant of the code above.

Discussion

  • Riot

    Riot - 2014-12-29

    That code didn't paste correctly; it should be:

    class Myclass {
      myfunction1() {
        //(){
        //}
      }
    
      // this should be folded
      myfunction2() {
      }
    };
    
     
  • Neil Hodgson

    Neil Hodgson - 2014-12-29
    • labels: --> scintilla, cpp
    • status: open --> open-invalid
    • assigned_to: Neil Hodgson
    • Priority: 5 --> 3
     
  • Colomban Wendling

    This is actually not a bug but a feature :)

    The C++ lexer has support for explicit fold points, which default to //{ (open) and //} (close).
    This is controlled by the fold.comment and the fold.cpp.comment.explicit lexer properties (the latter defaults to enabled when the former is). You can then disable this by setting fold.cpp.comment.explicit to 0, or by changing the fold.cpp.explicit.start and fold.cpp.explicit.end properties.

     
  • Neil Hodgson

    Neil Hodgson - 2014-12-29

    If there are any reproducible cases of permanently disappearing text in SciTE then that would be worth fixing.

     
  • Neil Hodgson

    Neil Hodgson - 2015-01-11
    • status: open-invalid --> closed-invalid
     

Log in to post a comment.

MongoDB Logo MongoDB