X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/9a6c88c7f4b4db14631f8dc9e8d44b3aed9d57c9..c7bc22388d30f1ba503eefd574e4bb794749b782:/black.py diff --git a/black.py b/black.py index afc37d9..e1a71e8 100644 --- a/black.py +++ b/black.py @@ -2599,7 +2599,8 @@ def generate_trailers_to_omit(line: Line, line_length: int) -> Iterator[Set[Leaf if length > line_length: break - if leaf.type == STANDALONE_COMMENT: + has_inline_comment = leaf_length > len(leaf.value) + len(leaf.prefix) + if leaf.type == STANDALONE_COMMENT or has_inline_comment: break optional_brackets.discard(id(leaf)) @@ -2940,9 +2941,6 @@ def enumerate_with_length( comment: Optional[Leaf] for comment in line.comments_after(leaf, index): - if "\n" in comment.prefix: - return # Oops, standalone comment! - length += len(comment.value) yield index, leaf, length