-
Notifications
You must be signed in to change notification settings - Fork 402
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
try fix bad alignment in unicode (#1144) #1145
try fix bad alignment in unicode (#1144) #1145
Conversation
Thank you, great find. Indeed, the length of Chinese characters is usually 2 (do you know any unicode points which map to 3 or more cells?), but here the assumption is <= 1. Now however And somewhere in the wrapping logic the same miscounting happens which results in truncation instead of wrapping, probably when Save the diff below as 'badwrap' and run: @@ -1,5 +0,0 @@
-一二三四
-1一二三四
-12一二三四
-123一二三四
-123456789 |
3e9d105
to
94558b1
Compare
I didn't find any Chinese character map to 3 or more. But from the code in unicode-width, 3 means ambiguous width.
Yes, Add a symbol before is much better. I will try in my next commit. |
Hi @SheldonNico, thanks very much for working on this. I'm sorry I let it slip and then forgot about it. |
Add space(no custom symbol for simplicity) in But change how width calculated in wrapping need too much modifications, and some modifications may not be right since I didn't figure out all function logical. I try to fix broken tests, and it seems to work. Feel free to not accept this PR, if you have plan in the future. |
Yes, original test find one: क्षि , and playground. It break my text editor. But in browser, it take 2 columns. |
Very nice, looks good to me. Also, you may add this commit which will correct the tests instead of adapting the code to work with the old tests.
Yes, that would have to become customizable. I will do that later when making the wrapping aware of word boundaries. |
Done. As I notice, there are some updates. Do I need to do something in my branch? |
Thank you very much @SheldonNico and @th1000s. This will be released today. |
Add spaces in
truncate_str
doesn't satisify the function description. So I change the functionpad_panel_line_to_width
(maybe not right)