Fold line breaks after update to Notepad++ 7.2.2



  • 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?



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



  • 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.



  • @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



  • 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.



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

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

    looks ok.

    Cheers
    Claudia



  • 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')?



  • @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


Log in to reply