-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add Grapheme cluster support #5
base: master
Are you sure you want to change the base?
Conversation
go.sum
Outdated
@@ -0,0 +1,2 @@ | |||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= | |||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of fixing the width counting issue but not in favor of picking up a dependency outside the stdlib (or maaaaaybe golang.org/x/text). It looks like this was proposed to be upstreamed into golang.org/x/text in golang/go#14820 (comment).
I'd accept a change that used an upstreamed version of this in golang.org/x/text or unicode/utf8, or a direct implementation of the Grapheme Cluster Boundary Rules in a private function in this library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR to attempt to use a direct implementation from the uniseg code but there's an awful lot of lookup tables that are required to implement them, and the golang.org/x/text issue does not seem to have progressed since 2019.
This has become a rabbit hole.. most terminals seem to support Unicode 8 or 9 rather than the latest and treat most Emoji that should be double-width as single width, with additional advanced settings to only make them double-width in the presence of Emoji-presentation variation selectors. Therefore I'm not sure a standard approach can be reached without numerous flags to support all options. |
No description provided.