If terminal doesn't have a seperate screen buffer, but allow cursor movement, you can use new linereturn to create the new "screen", not touching the scrollback buffer above.
#############################
###### previous buffer ######
#############################
#############################
#############################
#############################
#############################
#############################
#############################
> new screen here
> new screen here
> new screen here
> new screen here
> new screen here
> new screen here
> new screen here
> new screen here
enter: CSI ? 1 0 4 7 h
leave: CSI ? 1 0 4 7 l
See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
ti
and te
switches to and back from an alternate screen buffer.
See man termcap
.
enter: smcup
leave: rmcup
If nrrmc
is set, then smcup
will clean the alternate screen first.
See man terminfo
.