From: Ɓukasz Langa Date: Thu, 15 Mar 2018 21:54:37 +0000 (-0700) Subject: Fix spurious space after unary expression X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/5370714c963fa59d84356e2841882e42ab16641e?ds=inline;hp=da3c2f358208dc9838c63d57b66c89e164eb241a Fix spurious space after unary expression This happened when the operand was a complex expression. Fixes #15 --- diff --git a/README.md b/README.md index 63fb4b2..c0870a8 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,12 @@ You can still try but prepare to be disappointed. * fixed spurious space in parenthesized set expressions (#7) +* fixed spurious space after opening parentheses and in default + arguments (#14, #17) + +* fixed spurious space after unary operators when the operand was + a complex expression (#15) + ### 18.3a0 diff --git a/black.py b/black.py index 75fbdca..d48fddb 100644 --- a/black.py +++ b/black.py @@ -815,6 +815,9 @@ def whitespace(leaf: Leaf) -> str: if prevp.parent and prevp.parent.type == syms.subscript: return NO + elif prevp.parent and prevp.parent.type == syms.factor: + return NO + elif prev.type in OPENING_BRACKETS: return NO diff --git a/tests/expression.py b/tests/expression.py index 1d9f0ab..6870749 100644 --- a/tests/expression.py +++ b/tests/expression.py @@ -31,6 +31,7 @@ not great -1 ~int and not v1 ^ 123 + v2 | True (~int) and (not ((v1 ^ (123 + v2)) | True)) +flags & ~ select.EPOLLIN and waiters.write_task is not None lambda arg: None lambda a=True: a lambda a, b, c=True: a @@ -155,6 +156,7 @@ not great -1 ~int and not v1 ^ 123 + v2 | True (~int) and (not ((v1 ^ (123 + v2)) | True)) +flags & ~select.EPOLLIN and waiters.write_task is not None lambda arg: None lambda a=True: a lambda a, b, c=True: a