Commit c7846b11 authored by Barry Warsaw's avatar Barry Warsaw

_split_ascii(): In the clause where curlen + partlen > maxlen, if the

part itself is longer than maxlen, and we aren't already splitting on
whitespace, then we recursively split the part on whitespace and
append that to the this list.
parent 86b5a4d4
......@@ -456,6 +456,13 @@ def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars):
elif curlen + partlen > maxlen:
if this:
lines.append(joiner.join(this) + eol)
# If this part is longer than maxlen and we aren't already
# splitting on whitespace, try to recursively split this line
# on whitespace.
if partlen > maxlen and ch <> ' ':
this = [_split_ascii(part, maxlen, restlen,
continuation_ws, ' ')]
else:
this = [part]
linelen = wslen + partlen
maxlen = restlen
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment