Repository navigation
Wrap line at boundary if it includes a CJK character - #9997
Conversation
|
Example looks good to me. I want to test in local, but have a problem with building: I'm not familiar with npm, after google I can not find some similar problems, any ideas? |
There was a problem hiding this comment.
Style nitpick: isCJKCharacter
|
Thanks for jumping on this! |
|
@as-cii Thanks, the new screenshot looks perfect to me! |
|
I success build atom on local by downgrade npm to 1.4.28. It is a big improvement. But I found it will leave a large space in some situation, for example: Line length 80 When add one more English character, it becomes: |
|
@chloerei: what behavior would you expect in that case? Seems like we should wrap at the beginning of the english word, as Chrome does. I have pushed a couple of commits that refine the previous behavior to address your concerns. Could you pull this again and try it out? Thanks so much for helping out with this, @chloerei! ✨ |
|
👍 I test with my blog posts and feel it's great! |
|
Great, I am going to 🚢 this as soon as the build gets 💚. Thank you! |
|
Hi, I'm still having trouble building Atom on Windows, but judging from the committed code, here's how I feel. I'm totally new to Atom dev, and I've never treated Unicode seriously, so I might be wrong.
|
|
Thanks @yukihop for writing down these thoughts, I appreciate them a lot! 👍
Those are really good points. 👍 I will address them shortly.
Yeah, that was basically the reason why I did not include them originally. I think, however, we should add them just to be sure to cover every edge case and be more bulletproof. Will change this PR to fix those as well. Thanks a lot, @yukihop! Having a second pair of 👀 on CJK characters is definitely awesome! |
|
Okay, I slightly adjusted names and partially extended the ranges checked in |
Wrap line at boundary if it includes a CJK character
|
@as-cii Thank you! I hope this fix will be included in the next bug fix release. I really need this one 🙏 |
|
Yeah, I think we are going to release this one under |
Fixes #9447.
This PR provides a different strategy for wrapping lines whenever CJK characters are involved. With this PR we try to detect a CJK character before or exactly at the desired wrap boundary: if we do, we perform the wrap; otherwise, we use the old line-breaking algorithm.
Although not compliant with the Unicode spec, this allows users to mix CJK characters with Latin ones without the need to introduce a complex line breaking logic.
Before:
After:
/cc: @nathansobo @atom/feedback