Skip to content

Commit 19fd626

Browse files
committed
Don't pre-split long words when max_lines is set
1 parent bf3fffa commit 19fd626

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎Lib/textwrap.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ def _wrap_chunks(self, chunks):
283283
# long word for all of them at once. Breaking off one line at a
284284
# time would copy the rest of the word each time.
285285
word = chunks[-1]
286-
if (lines and self.break_long_words and 0 < width < len(word) and
286+
if (lines and self.max_lines is None and self.break_long_words and
287+
0 < width < len(word) and
287288
not (self.break_on_hyphens and '-' in word) and
288289
word.split(None, 1) == [word]):
289290
del chunks[-1]

0 commit comments

Comments
 (0)