Enhanced Windows VT mode, and ALTSCREEN support #692
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.