https://bugs.kde.org/show_bug.cgi?id=356241

            Bug ID: 356241
           Summary: Python indenter should not keep indentation level
                    following complete class/function definitions with
                    blank lines in between
           Product: kate
           Version: unspecified
          Platform: Ubuntu Packages
               URL: http://pastebin.com/v7rUJZTJ
                OS: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: indentation
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: thomaskola...@gmail.com

At the moment, creating a new line anywhere in a python script where the last
non-blank line is indented (and not a dedenter) will always indent that line to
the previous indentation level.

While this may have been indented (as was this pun), it is VERY annoying for
editing files with many small class definitions. Not all code blocks have a
natural dedenter; and as a matter of fact, if one follows pep8, most of the
time, if there is more than one blank line between two lines, the second line
will not be indented at all. See also:
https://www.python.org/dev/peps/pep-0008/#blank-lines

In this light, assuming that the user wants to continue at the same indentation
level as a block many lines previous is likely a bug.

Reproducible: Always

Steps to Reproduce:
1. Open a new file, save as a python script
2. Enter the following:
"""
class Example(object):
    def example_method(self)
        self.mutate() # no return required


"""
3. With the cursor on the last line, type <enter>

Actual Results:  
two levels of indentation are inserted

Expected Results:  
insert no indentation, that method is too far away

I like Kate a lot and have been using it for years, it's my go-to editor when I
have multiple files that i switch between a lot, but this is seriously annoying
me, and I can't imagine that most people find this behaviour more useful than
annoying.

I crudely patched my own indenter and linked the diff, however, I can imagine
that there are probably better solutions (my patch checks if the two previous
lines are completely empty).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to