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

2021-07-02 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- assignee: -> serhiy.storchaka versions: +Python 3.11 -Python 3.8 ___ Python tracker ___ ___

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

2021-07-01 Thread Andrei Kulakov
Andrei Kulakov added the comment: Some observations: - Just to be clear (because annesylvie implied this is caused by exclamation marks), punctuation at the end of the word is not required to hit this bug: In [44]: shorten("hello universe", width=7, placeholder="") Out[44]: 'hello u' (so

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

2021-07-01 Thread Andrei Kulakov
Andrei Kulakov added the comment: Also see https://bugs.python.org/issue44544 which I think will help users avoid this issue. -- nosy: +andrei.avk ___ Python tracker ___

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

2021-03-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: Verified in 3.10.0a6 that change is at 3 !s. I agree that is is a bug relative to the doc. The issue is that 'world!!!' is 8 chars, and by default, wrap splits that into 'w' and 'orld!!!' and add ' w' to 'hello'. >>> sh('hello world!!!', width=7) ['hello

[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

[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