[issue43518] textwrap.shorten does not always respect word boundaries

2021-03-16 Thread annesylvie


Change by annesylvie :


--
components: Library (Lib)
nosy: annesylvie
priority: normal
severity: normal
status: open
title: textwrap.shorten does not always respect word boundaries
type: behavior
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue43518>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43518] textwrap.shorten does not always respect word boundaries

2021-03-16 Thread annesylvie


New submission from annesylvie :

The `shorten` function from the `textwrap` module does not always break strings 
at the correct location.

`shorten("hello world!", width=7, placeholder="")`
 returns
`'hello'`
as expected, but
`shorten("hello world!!", width=7, placeholder="")`
returns
`'hello w'`
which is incorrect. The error seems to appear when two or more exclamation 
marks (in this specific example) are added.

--

___
Python tracker 
<https://bugs.python.org/issue43518>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com