3 ms·
Even terminal programs that just write to stdout depend on the OS to some extent. On Windows, writing to a terminal window has different effects depending on t
by jlokier 5y ago
Even terminal programs that just write to stdout depend on the OS to some extent.
On Windows, writing to a terminal window has different effects depending on the type of terminal. The classic Windows Console doesn't understand VT codes but there are API calls to do the same things (position cursor, change attributes etc). Recent versions of Windows Console can be told to understand VT codes, but require an API call to enable VT interpretation, then they understand a subset. Windows Terminal isn't the same as Windows Console. Then there's running things under Mintty, or Cygwin Terminal. Control+C behaves differently under those than under the Windows Console. Then there's running things under "winpty" in a Cygwin Terminal, which uses a hidden Windows Console and translates the resulting character matrix as best it can to terminal codes. There are other terminal emulators too.
Linux terminals have a lot of diversity regarding which VT codes they interpret, but at least there's a common subset for most of them. There's also some variation about codes for keypress, such as modifiers with function keys.
If it uses terminfo or termcap to work with various terminals, there are some OS dependencies regarding what capabilities are likely to be indicated.
The color capability varies. Sending 24-bit color to some terminals will not have the desired effect on others.
Unicode support varies among terminals, and this toolkit uses plenty of Unicode in the demos: Radio buttons, check boxes, box drawing characters, and the bar graph demo. What counts as a wide character (two cells) also varies.
- arthur_sonzogni 5y agoAuthor of FTXUI here. Thanks for this answer! This is exactly the right reasons. Every terminal compatible with the main subset of the various VT specifications should be compatible with FTXUI. If someone can prove this wrong, I must fix this ;-) I own a Linux machine so this is the "main" target. Support is quite strong. However, I don't own a Windows machine and it's quite painful for me to test on it. Windows support has been added by contributors mostly. That's the reason I say it is still "experimental". The various Windows terminal requires some Windows specific calls to enable VT interpretation, as explained above. FTXUI can be compiled toward WebAssembly and executed against xterm.js terminal. This proves you can use FTXUI against a compliant terminal and not really depends on OS calls. https://arthursonzogni.com/FTXUI/examples/ https://arthursonzogni.com/FTXUI/examples/ There are some function depending on the systems: - Windows diverges a bit (see above) - Getting terminal dimensions. - Getting terminal support for colors.
- einpoklum 5y agoFirst, I suggest you try to use terminfo to properly ensure your terminal supports the "main subset" you've mentioned. Second, I suggest you get in contact with Thomas E. Dickey, the maintainer of libncurses and terminfo, to see how he tests that library - on something like 15 different platforms. Finally, over time, consider relaxing your set of terminal requirements - either with workarounds or with limitation of functionality for less-capable terminals.
- ncmncm 5y agoI guess that working with more primitive terminals would make easier to use to drive UIs on embedded targets. The "terminal" Ftxui sees becomes just some LCD-painting primitives.