Closed iffy closed 2 years ago
Yes, true color support would be fabulous.
It is supported in terminal.vim , which is used by illwill.
Is there a reason for not using true colors in illwill ?
@iffy
I think the length detection can be useful sometimes, but in actual reality you almost always know when you are going to output a double-width char, so you just follow it with a space then. This should exist in another library, I don't want to merge this code into illwill.
About true-colour support, that can be handy and it would be cool to extend illwill with support for it, I agree. I'd just add the bare minimum for it in illwill, though, and ditch all the various other helper methods you have. I'd like to keep illwill dependency free.
Just a tip for your width-detection routine: you might want to make sure that it works correctly with NerdFonts. See this issue for further details. You might also want to check out the mintty sources for identifying the "wide" codepoint ranges.
@jeangit
Is there a reason for not using true colors in illwill ?
When I started illwill, terminal.nim didn't support it and I don't really have a need for it. But as I said above, it would be cool to add support. Are you up for creating a PR? 😄
@johnnovak, That sounds reasonable to me. Feel free to leave this issue open when it supports true colors or close it for another one if you'd like. I won't have time soon to submit a PR, but in the future when I get back to my TUI I will.
Closing due to inactivity/lack of interest.
Wide Characters
On macOS Terminal (and I assume other terminals), the current version of illwill assumes that all characters occupy one space. Emoji and some other characters actually occupy 2 spaces. For aligning tables and boxes, it's important to know how wide strings are. For example, see that the smiley below covers 23 and the last two characters each cover 2 spaces:
True Colors
Some terminals support 16 colors, some 256 and some 24-bit "true color." It would be nice if illwill did, too. Then you can do things like this:
Windows CMD prompt:
Windows Terminus (lacks 256 color support):
macOS Terminal:
I've looked at how other libraries work around this and have come up with: https://github.com/iffy/termtools It contains methods for detecting wide char string lengths and color escape sequence generation.
I think my preference is to depend on this new library as others might want the widechar and color support it provides without making a curses-like UI that illwill provides. But I'm interested in your thoughts before I proceed.