]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fix spurious space after unary expression
authorŁukasz Langa <lukasz@langa.pl>
Thu, 15 Mar 2018 21:54:37 +0000 (14:54 -0700)
committerLukasz Langa <ambv@fb.com>
Thu, 15 Mar 2018 21:54:37 +0000 (14:54 -0700)
This happened when the operand was a complex expression.

Fixes #15

README.md
black.py
tests/expression.py

index 63fb4b2e58eeac2a3eac8d53c2a97dc0d78ac53d..c0870a8d748ccf49571f2c7ccfab3c4cda62b73a 100644 (file)
--- 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
 
index 75fbdcadd41159f0b38446288f1b05c5f1408995..d48fddbe6526d6dc2753a71c482e53afe8c2f9ee 100644 (file)
--- 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
 
index 1d9f0ab57ade05f8f35ef02b04962e6c6673da31..68707498aefe2d0f3310526c0fbac668da617091 100644 (file)
@@ -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