-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Unicode handling in xterm.js #1709
Comments
I think something like this might be more approachable: interface IUnicodeProvider {
getVersion(): string;
wcwidth(ucs: number): number;
getStringCellWidth(s: string): number;
... // more to come with support of other unicode features
} With something like a |
@dnfield Yeah either way will work. Not sure though if we will need the type info at the version level. My idea was to create an interface, that can transparently do the version switches at runtime like this: // terminal ctor - create the provider
this.unicodeProvider = new UnicodeProvider();
...
// some code that knows whether to switch unicode versions
this.unicodeProvider.setVersion(xy);
...
// some unicode consumer - does not care about versions at all, just gets the right method
this.unicodeProvider.wcwidth(...) This way |
What I get from the discussion in #1707:
Any takers to get that into TS code? |
No problem! |
Please fix ASAP, updating Windows recently seemed to break this for me. I'm attempting to support a Node.js library that emoji'fies some aspects of logging for easier readability (it sounds much goofier than it is). |
New attempt in #2568, hopefully we can get this rolled out with next release. |
Coming from #1707 it seems the correct unicode handling is more and more an issue for people due to emojis. Since we all love emojis this should get fixed ASAP 😄
Proposal:
Create a provider for different unicode versions, that is capable of hiding the version specific data and implementations behind a nice API. Currently we only need version dependent implementations for wcwidth, so a rough sketchup could look like this:
Ideally the provider is self containing, thus the terminal just needs to deal with the interface methods and updates the version/locale when needed. The provider would have to deal with the low level stuff to provide the correct data sets so the methods just work as expected for a supported version.
Within the provider we then can decide whether the data is provided statically in the code base or even tries to create the data on the fly. First will have quite an impact on xterm.js' size, the second will raise async questions (remember - most of the core parts are synchronous atm). The whole unicode stuff could also be bundled into some addon like feature for version XY.
Up for discussion.
/cc @Tyriar, @bgw, @mofux, @dnfield
The text was updated successfully, but these errors were encountered: