gh-134200: Add adaptive global alignment for help text#134308
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
savannahostrowski
left a comment
There was a problem hiding this comment.
Apologies for missing this back in May. Thanks for looking into this - I tested the changes and while they work as described, I think that the visual impact here is very minimal compared to code complexity this introduces. I'm also a bit concerned about the impact this will have on anyone whose tests depend on the current indentation. I don't think we should move forward with this change.
|
I've closed the corresponding issue for this so will also close this. Thanks again. |
Refactors
HelpFormatterto improve help text readability and consistency,addressing issues where argument string lengths varied widely.
Previously, a single very long option could push all help text excessively
to the right, or groups of only short options might not align optimally.
Key changes:
A global help alignment column is now calculated by finding the display
endpoint of the longest "reasonable" argument invocation string across
all sections, adding a 2-space padding.
indent and minimal padding) does not exceed the overall maximum help
position (derived from
max_help_positionand terminal width, e.g., 24).maximum help position.
Help text for arguments is formatted against this single global column:
begins at this alignment column.
have their help text start on the next line, also indented to this
alignment column.
This ensures:
longest member, rather than being forced to an unnecessarily wide default.