X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/a20338cf100ff20a24e2058c6f6014e82efdf914..a91eb73064c9bef76c3a961ab662bb5f75a1543d:/src/black/lines.py diff --git a/src/black/lines.py b/src/black/lines.py index f3044ce..71b657a 100644 --- a/src/black/lines.py +++ b/src/black/lines.py @@ -711,6 +711,17 @@ class EmptyLineTracker: newlines = 0 else: newlines = 1 + # Remove case `self.previous_line.depth > current_line.depth` below when + # this becomes stable. + # + # Don't inspect the previous line if it's part of the body of the previous + # statement in the same level, we always want a blank line if there's + # something with a body preceding. + elif ( + Preview.blank_line_between_nested_and_def_stub_file in current_line.mode + and self.previous_line.depth > current_line.depth + ): + newlines = 1 elif ( current_line.is_def or current_line.is_decorator ) and not self.previous_line.is_def: