feat: join strings with a conjunction in a handful of languages - #14
Merged
Conversation
Contributor
|
LOVE THIS! |
tzengyuxio
added a commit
to tzengyuxio/x
that referenced
this pull request
Apr 9, 2026
Wide characters (CJK ideographs, fullwidth chars) can be broken between any two characters per Unicode line breaking rules (UAX charmbracelet#14). Previously, consecutive wide characters were accumulated into the word buffer and treated as a single long "word", causing suboptimal wrapping: - Mixed CJK/Latin text like "vault 不只是記事本" would push the entire CJK sequence to the next line instead of filling the current line - CJK text only got hard-wrapped when the word exceeded the limit, wasting space at the end of lines Now wide characters (width > 1) are written directly to the output buffer, allowing line breaks between any two wide characters. This produces more natural wrapping for CJK text while preserving word boundaries for narrow (Latin) characters.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At last, join strings in the way they would be read by a human being. For example,
[]string{"cheese", "beans", "jalapeños"}can become"cheese, beans and jalapeños", with a flick of the wrist.English users can also opt into to the Oxford Comma with the hot
EnglishJoinfunction:The following languages are supported: