Unicode handling in xterm.js
See original GitHub issueComing 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:
interface IUnicodeProvider {
supportedVersions(): string[];
getVersion(): string;
setVersion(version?: string); // version optional for fallback behavior
wcwidth(ucs: number): number;
getStringCellWidth(s: string): number;
... // more to come with support of other unicode features
}
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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:10 (7 by maintainers)
Top GitHub Comments
New attempt in https://github.com/xtermjs/xterm.js/pull/2568, hopefully we can get this rolled out with next release.
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).