Change utils.wrap() to indent on all lines, not only the lines following the first. If someone remembers why this default was set, do report it.

This commit is contained in:
Griatch 2016-08-25 18:36:21 +02:00
parent 83f67ac2c4
commit ecb7d6fcc5

View file

@ -85,8 +85,7 @@ def wrap(text, width=_DEFAULT_WIDTH, indent=0):
Args: Args:
text (str): The text to wrap. text (str): The text to wrap.
width (int, optional): The number of characters to wrap to. width (int, optional): The number of characters to wrap to.
indent (int): How much to indent new lines (the first line indent (int): How much to indent each line (with whitespace).
will not be indented)
Returns: Returns:
text (str): Properly wrapped text. text (str): Properly wrapped text.
@ -96,7 +95,7 @@ def wrap(text, width=_DEFAULT_WIDTH, indent=0):
return "" return ""
text = to_unicode(text) text = to_unicode(text)
indent = " " * indent indent = " " * indent
return to_str(textwrap.fill(text, width, subsequent_indent=indent)) return to_str(textwrap.fill(text, width, initial_indent=indent, subsequent_indent=indent))
# alias - fill # alias - fill
fill = wrap fill = wrap