Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/test/test_textwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def test_break_long(self):
# bug 1146. Prevent a long word to be wrongly wrapped when the
# preceding word is exactly one character shorter than the width
self.check_wrap(self.text, 12,
['Did you say ',
['Did you say',
'"supercalifr',
'agilisticexp',
'ialidocious?',
Expand Down Expand Up @@ -633,7 +633,7 @@ def test_nobreak_long(self):

def test_max_lines_long(self):
self.check_wrap(self.text, 12,
['Did you say ',
['Did you say',
'"supercalifr',
'agilisticexp',
'[...]'],
Expand Down
2 changes: 1 addition & 1 deletion Lib/textwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):

# If we're allowed to break long words, then do so: put as much
# of the next chunk onto the current line as will fit.
if self.break_long_words:
if self.break_long_words and space_left > 0:
end = space_left
chunk = reversed_chunks[-1]
if self.break_on_hyphens and len(chunk) > space_left:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix trailing space before a wrapped long word if the line length is exactly
*width* in :mod:`textwrap`.
Loading