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.
elif curlen + partlen > maxlen:
if this:
lines.append(joiner.join(this) + eol)
- this = [part]
+ # 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
else: