useAlternateScreen top-level constant

String const useAlternateScreen

Switches to the screen a full-screen program draws on.

The cursor is saved, the alternate screen is cleared and everything is drawn there, leaving the screen the program was started from untouched. useMainScreen brings that one back, scrollback and all, with the cursor where it was left.

There is an older pair for this, CSI ? 47 h and CSI ? 47 l, which switches the screen without saving the cursor or clearing anything. This one does all three, and is what terminals have followed since.

Implementation

const String useAlternateScreen = '$CSI?1049$SM';