Repository navigation
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
21c6877 to
4497db3
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
4497db3 to
baba0c5
Compare
# Conflicts: # Doc/whatsnew/3.16.rst
baba0c5 to
36a27ac
Compare
36a27ac to
ac1a642
Compare
ac1a642 to
090c887
Compare
TextWrapper ANSI-awareTextWrapper ANSI-aware
Documentation build overview
453 files changed ·
|
8327c94 to
ba63d75
Compare
219db60 to
8e3c15a
Compare
8e3c15a to
3cdc69f
Compare
TextWrapper ANSI-awareTextWrapper ANSI-aware
TextWrapper ANSI-awaretext_len to TextWrapper
For ANSI and variable character width awareness. Removes local patch introduced in python#154634.
3cdc69f to
847d242
Compare
For ANSI and variable character width awareness. Removes local patch introduced in python#154634.
847d242 to
1497de0
Compare
For ANSI and variable character width awareness. Removes local patch introduced in python#154634.
4f1e56d to
27b653d
Compare
|
This PR is stale because it has been open for 90 days with no activity. |
27b653d to
56ea2d3
Compare
|
I just reworked this PR to focus on the cases of wrapping variable-width characters, add more edge-cases around these and drop all references to ANSI so I do not need to touch the This PR relates to the following issues and does not try to fix them but need them for full coverage of edge-cases:
So if any of the one above get merged first I will need to rebase this one and rework it a bit. |
Description
Add a
text_lenparameter totextwrap.wrap(),textwrap.fill(),textwrap.shorten()andtextwrap.TextWrapper. It sets how the width of a string is measured, so text with double-width or zero-width characters wraps to the right number of columns:text_lenmust be additive: the width of a string is the sum of the widths of its characters. ANSI escape sequences do not follow this rule, so this PR does not touch theargparsefix of #154634.Context
I am a maintainer of Click and had to maintain my own local fork of
TextWrapperto make it strip ANSI strings properly. See my initial code at: pallets/click#3420 .This PR was initially a direct port of that code to Python standard library. But after the fact I realized that a width function cannot handle escape sequences, so this PR was fixes to only focus on variable-width characters.
This PR:
text_lentoTextWrapperfor variable character width awareness #154686text_lentoTextWrapperfor variable character width awareness #154686