Use reserved width to include line suffix measurement (#6901)

Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
Chris Pryer 2023-08-30 04:07:11 -04:00 committed by GitHub
parent edfd888bd6
commit a3f4d7745a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 504 additions and 80 deletions

View file

@ -14,6 +14,6 @@ def function(a:int=42):
a
b
"""
#  There's a NBSP + 3 spaces before
#    There's a NBSP + 3 spaces before
# And 4 spaces on the next line
pass

View file

@ -66,3 +66,6 @@ g2 = ( # a
h1 = ((((1, 2))))
h2 = ((((1, "qweiurpoiqwurepqiurpqirpuqoiwrupqoirupqoirupqoiurpqiorupwqiourpqurpqurpqurpqurpqurpqurüqurqpuriq"))))
h3 = 1, "qweiurpoiqwurepqiurpqirpuqoiwrupqoirupqoirupqoiurpqiorupwqiourpqurpqurpqurpqurpqurpqurüqurqpuriq"
i1 = ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",) # This should break

View file

@ -0,0 +1,6 @@
# As of adding this fixture Black adds a space before the non-breaking space if part of a type pragma.
# https://github.com/psf/black/blob/b4dca26c7d93f930bbd5a7b552807370b60d4298/src/black/comments.py#L122-L129
i2 = "" #  type: Add space before leading NBSP followed by spaces
i3 = "" #type: A space is added
i4 = "" #  type: Add space before leading NBSP followed by a space
i5 = "" # type: Add space before leading NBSP