New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable automatic word wrap based on desired maximum column width #117
Conversation
will be automatically wrapped to fit within these bounds, and this wrapping will honor wide characters and ANSI color codes
The pull request looks good, nothing that catches my eye. I'm merging it. Thank you, Matt. |
Any idea which version will this change get published in? |
@tejasjadhav Next version (0.8.10). There is not much else to release yet. You may install the git version if you want. |
@astanin understood 👍 I'll use the Git version till then. |
@astanin - I know its already been asked, but any chance that this PR can get pushed out soon? |
getting an error using the git version &
i think text needs a |
Hi @astanin , Thanks. |
Has this been released? |
Tried this out from source, and I noticed the header does not honor the maxcolwidths...is there any thoughts to perhaps supporting that capability as well? |
This address as submitted issue #90 that allows automatically word wrapping long text string. From an API standpoint, this is automatically enabled by simply specifying the maximum column width for a given column. I selected max column width instead of just column width to remove any confusion where a user might think that specifying
colwidth
might be setting a guaranteed size, which is not the behavior here (though I could see it as a possible future update?)The "magic" here is a customized version of the
textwrap.TextWrapper
class to not use justlen
for strings and to also preserve ANSI color codes around wrapped lines. This is a non-trivial bit of code (even though heavily copy/pasted) with possible regression concerns, so I put it into a new test file to help tack this closely. Hopefully this fits within this projects idioms.To address the 'tests that need to be covered' from the issue discussion:
disable_numparse
. Let me know if you had something else in mind,maxcolwidth
, so I believe this meets the ability to ensure it does not impact these formatsHere's a small sample program I used to quickly demonstrate all the big capability updates