-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Add better support for CJK wrapping. #8838
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
base: master
Are you sure you want to change the base?
Conversation
…cter but not a tail prohibited punctuation.
In the VSCode codebase, this list is more complete. wordWrapBreakAfterCharacters: register(new EditorStringOption(
EditorOption.wordWrapBreakAfterCharacters, 'wordWrapBreakAfterCharacters',
// allow-any-unicode-next-line
' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」',
)),
wordWrapBreakBeforeCharacters: register(new EditorStringOption(
EditorOption.wordWrapBreakBeforeCharacters, 'wordWrapBreakBeforeCharacters',
// allow-any-unicode-next-line
'([{‘“〈《「『【〔([{「£¥$£¥++'
)), |
Thank you, that list is longer than that I expected, and some characters are to wide to use the overflow strategy. I need to come up with a more robust method rather than editing on current one. Stay tuned. |
Demo: Added a text input to word wrapping section to test word wrapping without recompiling the code Current code lacks optimization and seems to report false real line widths (See Demo -> Text -> Word Wrapping, the boundary takes space into consideration) and buggy... |
I found why my behavior is different, my algorithm wraps at the space before words, the old algorithm wraps at the end of words. The rendering result is same. Wrap candidates before:
Wrap candidates after:
|
Added better wrapping for mixed language text.
Notice how "PR 的同时" in the second paragragh break in the two videos.
Demo text used: The Chinese translation of CONTRIBUTING.md in this repo and 离骚
After.mp4
Before.mp4
TODO:
0x3003 <= c && c <= 0xFFFF
.Needs feedback in real use cases, currently only tested with a few examples.