X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/6284953d07060804dcdeacf4626b76aed7a20683..cd055efd7d999421984e8b63afe53b5f9854deb9:/src/black/__init__.py?ds=inline diff --git a/src/black/__init__.py b/src/black/__init__.py index 3753d5f..bfb7712 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -3507,9 +3507,12 @@ class BaseStringSplitter(StringTransformer): # WMA4 a single space. offset += 1 - # WMA4 the lengths of any leaves that came before that space. - for leaf in LL[: p_idx + 1]: + # WMA4 the lengths of any leaves that came before that space, + # but after any closing bracket before that space. + for leaf in reversed(LL[: p_idx + 1]): offset += len(str(leaf)) + if leaf.type in CLOSING_BRACKETS: + break if is_valid_index(string_idx + 1): N = LL[string_idx + 1]