Help save net neutrality! Learn more.

Python indenting problem

  • jason

    jason - 2006-09-17

    I love Notepad++, but there seems to be an indenting glitch that makes it incompatible with Python. (If someone has a solution to this, please let me know!)

    Suppose you enter

    def func():
        if (1):
            print "hello"

    Now, I understand that after typing in "hello" and return, indenting rules will place the cursor directly under the 'p' from 'print'. If we want the next line to be unindented, we have to manually back up the cursor (or use shift-tab).

    But after you've backed the cursor up, so it's under the 'd' from 'def', and hit return again... it jumps back to its position under 'p'! This makes it a real pain to put lines of whitespace under a function definition!

    Two further comments: (1) This issue doesn't come up in C/Java/Perl, because those languages have end-of-block delimiters that reset the indenting; and (2) this seems like a glitch that only concerns column-1: if the whole text is shifted over using Tab, indenting behaves very well.

    Does anyone who regularly uses Notepad++ with Python have the ability to easily put in blank lines after a function block?

    • jason

      jason - 2006-09-17

      Sorry-- my previous post didn't print the leading spaces, so the indenting didn't show up, which is the whole point!

      The example should read (with '_' for indenting):

      def func():
      ____ if (1):
      ________ print "hello"