formatter.py: Use prev_line_type more often

This commit is contained in:
gregorni 2023-09-18 16:43:24 +02:00
parent 1e0251fcce
commit 53534d08b0

View file

@ -87,7 +87,7 @@ class Format:
if two_newlines: if two_newlines:
another_newline( another_newline(
not (current_line[-1] == ";" and last_added_char in CLOSING_TOKENS) not (current_line[-1] == ";" and prev_line_type == LineType.BLOCK_CLOSE)
) )
end_str += current_line + whitespace_to_add end_str += current_line + whitespace_to_add
@ -140,7 +140,7 @@ class Format:
not ( not (
prev_line_type prev_line_type
in [LineType.CHILD_TYPE, LineType.COMMENT] in [LineType.CHILD_TYPE, LineType.COMMENT]
or last_added_char in OPENING_TOKENS or prev_line_type == LineType.BLOCK_OPEN
), ),
LineType.BLOCK_OPEN, LineType.BLOCK_OPEN,
) )