Collapse level 2 not working for python language

  • Collapse level 1 works but Collapse level 2 doesn’t work for following Python code. [Notepad++ v7.5.8 (32-bit)].
    Language is set to Python.

    class C1:
        def f1():
        def f2():

    The fold margin shows the fold level correctly. If i put cursor inside a function and click Collapse current level, then it works correctly.

    Is this a bug?


  • I tried on v7.5.6 32bit, and it seems to not work right for me: collapse level 2 doesn’t collapse the two def's. When I switched to a different language (Perl), with

    sub blah {
        do     {
            tertiary: {
        while(1) {

    I was able to properly collapse and uncollapse levels 1, 2, or 3 without difficulty in Perl; but if I switch the language to python, it will only do level 1.

    Thus, it doesn’t seem to be solely the fault of v7.5.8, and it seems to be limited to Python.

    I just searched the issues page, and found already reported … Based on what they said there (each space if indent gives a new level), I tried to collapse level 5 on your example, and the two def’s collapsed. So the bug isn’t with Notepad++, it’s with the Python-lexer that comes bundled with Scintilla that comes bundled with Notepad++. And it appears that it’s not going to be fixed, because the author disagrees that it’s a bug (it’s working as he designed it, apparently).

    So you might have to get used to calling a 4-space indent “level 5”. (sorry to be the bearer of bad news.)

Log in to reply