Community
    • Login

    Fold line breaks after update to Notepad++ 7.2.2

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 3 Posters 4.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MU-SoftwareM
      MU-Software
      last edited by

      I’m using Notepad++ x32 on Windows 10 14393.479 x64.
      After installing update to 7.2.2, Folding line breaks except Python language.
      It happens almost every languages.

      For example, this is what i expected,
      This is normal one

      And this is what it happens now
      This is normal one

      What should i do to recover this?

      1 Reply Last reply Reply Quote 0
      • dailD
        dail
        last edited by

        Can you paste a snippet of code that has the issue?

        1 Reply Last reply Reply Quote 0
        • MU-SoftwareM
          MU-Software
          last edited by

          Of course. But first, i have to edit original post.(Too late to edit the original one :-( )

          Folding line breaks on some code.
          It happens when i paste code from Visual Studio Community 2015 Update 2
          (Korean Language pack installed).

          Yeah, that’s my mistake. Sorry about that :-P
          Anyway, Here’s the file.
          I tried changing EOL type to Windows, Unix, and mac but that didn’t worked.

          Claudia FrankC 1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank @MU-Software
            last edited by

            @MU-Software

            looks like the C lexer has problems with line commented fold blocks.
            It is working by either using a space between // and } or block comments /* */.
            Didn’t check if it is already announce to scintilla devs.

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 0
            • dailD
              dail
              last edited by

              This is a Scintilla “feature” rather than a bug, though not a very intuitive feature as it has confused several people.

              See: https://sourceforge.net/p/scintilla/bugs/1676/

              Supposedly it can be controlled with the fold.cpp.explicit.end and fold.cpp.explicit.start properties for the C++ lexer.

              1 Reply Last reply Reply Quote 0
              • Claudia FrankC
                Claudia Frank
                last edited by

                Looks like C lexer accepts this as well.
                A quick test setting

                editor.setProperty('fold.cpp.comment.explicit', '0')
                

                looks ok.

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 0
                • MU-SoftwareM
                  MU-Software
                  last edited by MU-Software

                  Thanks for reply, everyone!
                  Ok, I learned //} caused this bug, oh not a bug, it’s feature XD
                  Anyway how can i apply editor.setProperty('fold.cpp.comment.explicit', '0')?

                  Claudia FrankC 1 Reply Last reply Reply Quote 0
                  • Claudia FrankC
                    Claudia Frank @MU-Software
                    last edited by Claudia Frank

                    @MU-Software

                    you would need a plugin like python script or lua script to automate this task
                    becasue it is not a general setting but per buffer setting. Each time you open
                    a new c/cpp file the property needs to be set.

                    A python version would look like this

                    def setFoldProperty():
                        if editor.getLexerLanguage() == 'cpp' and editor.getProperty('fold.cpp.comment.explicit') != '0':
                            editor.setProperty('fold.cpp.comment.explicit', '0')
                            
                    def callbackLANGCHANGED(args):
                        setFoldProperty()
                     
                    def callbackBUFFERACTIVATED(args):
                        setFoldProperty()
                    
                    notepad.clearCallbacks()
                    notepad.callback(callbackBUFFERACTIVATED, [NOTIFICATION.BUFFERACTIVATED])
                    notepad.callback(callbackLANGCHANGED, [NOTIFICATION.LANGCHANGED])
                    

                    If you haven’t installed python script plugin already than I would suggest
                    to download the msi from here instead using plugin manager.

                    If you want to have this script executed each time you start npp you need to change the python script configuration from LAZY to ATSTARTUP and the content of this script needs to be in a file called
                    startup.py.

                    Note, both, c and cpp lexer are identified as cpp.

                    Cheers
                    Claudia

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors