gdamore / tcell

Tcell is an alternate terminal package, similar in some ways to termbox, but better in others.
Apache License 2.0
4.53k stars 306 forks source link

Enhanced Windows VT mode, and ALTSCREEN support #692

Closed gdamore closed 6 months ago

gdamore commented 6 months ago

This enables the use of VT mode on Windows by default everywhere except ConEmu (because ConEmu is too broken). The attempt to use (or not use) the vt mode can be controlled by the TCELL_VTMODE environment variable (set it to "enable" or "disable" -- default is enabled unless ConEmu is detected.)

This also uses the alternate screen buffer on Windows by default, with fixes to avoid clearing the non-alternate screen.

It also adds TCELL_ALTSCREEN as an override. This can be set to "disable" (on either Windows or POSIX), in which case we won't use the alternate screen. We also don't clear the screen on exit (or disengage) in that case, and the cursor may be at an indeterminate location. Applications may utilize this to arrange for Tcell to draw the screen, then drop to some other application (e.g. using GNU readline or something) while leaving the part drawn by tcell present. This is highly experimental, and I'm not formally documenting it yet because its likely brittle and may change in the future. It also doesn't work with every terminal type.