]>
git.madduck.net Git - etc/vim.git/blobdiff - src/black/lines.py
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:
+from black.strings import str_width
from blib2to3.pgen2 import token
from blib2to3.pytree import Leaf, Node
from blib2to3.pgen2 import token
from blib2to3.pytree import Leaf, Node
if not line_str:
line_str = line_to_string(line)
if not line_str:
line_str = line_to_string(line)
+ width = str_width if mode.preview else len
+
if Preview.multiline_string_handling not in mode:
return (
if Preview.multiline_string_handling not in mode:
return (
- len (line_str) <= mode.line_length
+ width (line_str) <= mode.line_length
and "\n" not in line_str # multiline strings
and not line.contains_standalone_comments()
)
and "\n" not in line_str # multiline strings
and not line.contains_standalone_comments()
)
return False
if "\n" not in line_str:
# No multiline strings (MLS) present
return False
if "\n" not in line_str:
# No multiline strings (MLS) present
- return len (line_str) <= mode.line_length
+ return width (line_str) <= mode.line_length
first, *_, last = line_str.split("\n")
first, *_, last = line_str.split("\n")
- if len(first) > mode.line_length or len (last) > mode.line_length:
+ if width(first) > mode.line_length or width (last) > mode.line_length:
return False
# Traverse the AST to examine the context of the multiline string (MLS),
return False
# Traverse the AST to examine the context of the multiline string (MLS),