mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	[3.14] gh-139065: Fix trailing space before long word in textwrap (GH-139070) (GH-139902)
Fix trailing space before a wrapped long word if the line length with
a space is exactly "width".
(cherry picked from commit 1c598e0436)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									08738ce521
								
							
						
					
					
						commit
						ade6dea24b
					
				
					 3 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -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
 | 
					        # 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.
 | 
					        # 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
 | 
					            end = space_left
 | 
				
			||||||
            chunk = reversed_chunks[-1]
 | 
					            chunk = reversed_chunks[-1]
 | 
				
			||||||
            if self.break_on_hyphens and len(chunk) > space_left:
 | 
					            if self.break_on_hyphens and len(chunk) > space_left:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					Fix trailing space before a wrapped long word if the line length is exactly
 | 
				
			||||||
 | 
					*width* in :mod:`textwrap`.
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue