Browse Source

Should fix empty chunks error

master
Gijs de Heij 4 years ago
parent
commit
d36c520f03
  1. 3
      asciiWriter/wrap_single_line.py

3
asciiWriter/wrap_single_line.py

@ -12,6 +12,7 @@ class TextWrapper(textwrap.TextWrapper):
def _wrap_chunks(self, chunks): def _wrap_chunks(self, chunks):
lines = [] lines = []
if (chunks):
"""Override the mother class method. """Override the mother class method.
Most of that method is directly copied from the original class, except Most of that method is directly copied from the original class, except
@ -108,6 +109,8 @@ class TextWrapper(textwrap.TextWrapper):
lines[-1] = prev_line + self.placeholder lines[-1] = prev_line + self.placeholder
return indent + self.placeholder.lstrip(), ''.join(reversed(chunks)) return indent + self.placeholder.lstrip(), ''.join(reversed(chunks))
else:
return '', []
def wrap_single_line (text, width=70, **kwargs): def wrap_single_line (text, width=70, **kwargs):
w = TextWrapper(width=width, **kwargs) w = TextWrapper(width=width, **kwargs)

Loading…
Cancel
Save