It would be nice for Linux built-in framebuffer tty to support true color. I wonder why it doesn't yet.
The last mentioned comment seems to be "it needs a large amount of code". So it should be possible in general?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
(The author’s title is fine — just uses a different meaning of “safe”)
I suspect that in a sufficiently fast terminal emulator you could get up to some shenanigans with some judiciously chosen terminal controls.
Here is one way to answer the question.
- ANSI escape sequences are a standard, and have been around since, what, 1976? Almost fifty years.
- POSIX doesn't specify terminfo.
- POSIX describes a tput utility command which supports only three operands: clear, init and reset, and mentions the TERM variable without giving concrete requirements about it.
Clearly, the standard-conforming, richly functional solution is to use the ECMA/ANSI control sequences!
terminfo is nonstandard, vendor-specific, legacy Unix cruft, standardizing which POSIX was not up to the task.
Any purely software based terminal emulator you're likely to come across will speak ANSI. Where you have the support problem is with legacy terminal hardware.
What is worse:
- our program that uses ANSI escapes not working with someone's nonstandard hardware terminal, but otherwise being highly portable; or
- our program requiring termios not working with any terminal, when ported to a certain platform, due to lack of termios on that platform.
I disagree. The vast majority of terminals will send the same sequences. There is almost never a case where handling the two options for backspace the same way will result in a bad user experience. What complicates this even more is that many terminals allow the user to modify which sequence the `Backspace` key sends (0x08 vs 0x7F). Any application relying on terminfo, where a user did not modify their terminfo entry, will interpret these wrong if a user has manually changed it.
Terminfo is not needed anymore. It served a purpose to let applications know how to talk to a terminal. That era is gone.