]>
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:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d4ff985 )
- Long values in dict literals are now wrapped in parentheses; correspondingly
unnecessary parentheses around short values in dict literals are now removed; long
string lambda values are now wrapped in parentheses (#3440)
- Long values in dict literals are now wrapped in parentheses; correspondingly
unnecessary parentheses around short values in dict literals are now removed; long
string lambda values are now wrapped in parentheses (#3440)
+- Fix two crashes in preview style involving edge cases with docstrings (#3451)
- Exclude string type annotations from improved string processing; fix crash when the
return type annotation is stringified and spans across multiple lines (#3462)
- Exclude string type annotations from improved string processing; fix crash when the
return type annotation is stringified and spans across multiple lines (#3462)
else:
docstring = docstring.strip()
else:
docstring = docstring.strip()
+ has_trailing_backslash = False
if docstring:
# Add some padding if the docstring starts / ends with a quote mark.
if docstring[0] == quote_char:
if docstring:
# Add some padding if the docstring starts / ends with a quote mark.
if docstring[0] == quote_char:
# Odd number of tailing backslashes, add some padding to
# avoid escaping the closing string quote.
docstring += " "
# Odd number of tailing backslashes, add some padding to
# avoid escaping the closing string quote.
docstring += " "
+ has_trailing_backslash = True
elif not docstring_started_empty:
docstring = " "
elif not docstring_started_empty:
docstring = " "
if (
len(lines) > 1
and last_line_length + quote_len > self.mode.line_length
if (
len(lines) > 1
and last_line_length + quote_len > self.mode.line_length
+ and len(indent) + quote_len <= self.mode.line_length
+ and not has_trailing_backslash
):
leaf.value = prefix + quote + docstring + "\n" + indent + quote
else:
):
leaf.value = prefix + quote + docstring + "\n" + indent + quote
else:
--- /dev/null
+# Regression test for #3427, which reproes only with line length <= 6
+def f():
+ """
+ x
+ """
+# Regression test for #3425
+def multiline_backslash_really_long_dont_crash():
+ """
+ hey there hello guten tag hi hoow are you ola zdravstvuyte ciao como estas ca va \ """
+
def multiline_backslash_3():
'''
def multiline_backslash_3():
'''
+# Regression test for #3425
+def multiline_backslash_really_long_dont_crash():
+ """
+ hey there hello guten tag hi hoow are you ola zdravstvuyte ciao como estas ca va \ """
+
+
def multiline_backslash_3():
"""
already escaped \\"""
def multiline_backslash_3():
"""
already escaped \\"""
assert_format(source, expected, mode)
assert_format(source, expected, mode)
+def test_docstring_line_length_6() -> None:
+ """Like test_docstring but with line length set to 6."""
+ source, expected = read_data("miscellaneous", "linelength6")
+ mode = black.Mode(line_length=6)
+ assert_format(source, expected, mode)
+
+
def test_preview_docstring_no_string_normalization() -> None:
"""
Like test_docstring but with string normalization off *and* the preview style
def test_preview_docstring_no_string_normalization() -> None:
"""
Like test_docstring but with string normalization off *and* the preview style