terminal-kit
Version:
256 colors, keys and mouse, input field, progress bars, screen buffer (including 32-bit composition and image loading), text buffer, and many more... Whether you just need colors and styles, build a simple interactive command line tool or a complexe termi
18 lines (10 loc) • 711 B
Markdown
To do that, ScreenBuffer need to support a sort of indexed chars.
Unicode greatest code points is 1FFFFF, so it never use the highest byte of an UInt32.
That byte could be used to store some flags.
A flag could be used to tell that the cell contains multiple combined chars (like diacritics).
If so, the lowest 24 bits would not be a code point, but an index to a globally shared lookup table containing
the one cell string for that index.
To do so, .readChar() and .writeChar() should be replaced.
Loader/saver should be rewritten.
When saving, the lookup table should be saved as well into the JSON header.
Also string-kit should be updated, new methods like .unicode.toComboArray() should be created.