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 is an option for implementing xterms Alternate Screen Buffer (#231). The solution here is to effectively add a second vscrn, VTERM_B, and rename the existing VTERM to VTERM_A.
Both Vscrns share the same event queue, and settings that are applied to one should for the most part also be applied to the other, but they have their own videobuffers allowing us to switch cleanly between them just as we switch between VTERM and VCMD. The alternate buffer, VTERM_B, has no scrollback.
These changes also introduce a new command for controlling the alternate screen buffer - it can be enabled or disabled, and there are hidden commands to force the terminal on to or of off the alternate buffer.
I'm not entirely happy with the scale of the changes here however. Adding a new Vscrn involves adding an additional member to a lot of arrays and its not always obvious which ones should be updated. Having the two VTERMs share some settings and not others, and also share their event queues (even though VTERM_B does technically have its own event queue allocated) is messy and seems a likely source for bugs.
But I don't see a simpler option. We could perhaps instead try just swapping out the contents of VTERMs videobuffer but thats going to involve similar effort keeping the two videobuffers settings in sync and adds some difficulties around disabling scrollback on the alternate buffer, but it does remove the mess around input queues. It is however probably worth investigating this approach in a separate branch just to validate whether this path is indeed the best option.
Before merging: