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
Fix print_status when using widechars in desc #410
Conversation
Thanks @redbug312 - happy to merge if you can fix the unit tests for this PR (#410) |
6ec00f1
to
4b6476a
Compare
Codecov Report
@@ Coverage Diff @@
## master #410 +/- ##
===========================================
+ Coverage 85.56% 99.29% +13.72%
===========================================
Files 15 7 -8
Lines 977 568 -409
Branches 169 108 -61
===========================================
- Hits 836 564 -272
+ Misses 136 3 -133
+ Partials 5 1 -4 |
This yields wrong results for combining character strings such as 'a\u0322' (returns 2 instead of 1) or strings containing non-printable characters, such as '\u200b\u200b\u200b' (returns 3 instead of 0). What we’re interested in is not the string length but the width in terminal cells. The third-party wcwidth module does just that with its wcswidth function, which is a pure Python implementation of the libc equivalent. |
thanks, like your suggestion @lachs0r |
@FichteFoll thanks for bumping this. I don't have much time - will merge much quicker if someone fixes tests. |
I found that passing widechars into
set_description()
would cause the width of description field miscalculated, and break the progress bar.These are the screen records of before and after this fix.