-
Notifications
You must be signed in to change notification settings - Fork 0
Description
I think man command or vim use Alternate Screen Buffer.
Currently, there is only one buffer to display contents.
Therefore, I need to implement an alt screen buffer as stated in the terminal specification.
This is show below.
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
The Alternate Screen Buffer
XTerm maintains two screen buffers. The Normal Screen Buffer allows you
to scroll back to view saved lines of output up to the maximum set by
the saveLines resource. The Alternate Screen Buffer is exactly as large
as the display, contains no additional saved lines. When the Alternate
Screen Buffer is active, you cannot scroll back to view saved lines.
XTerm provides control sequences and menu entries for switching between
the two.
Most full-screen applications use terminfo or termcap to obtain strings
used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo,
or the corresponding ti and te for termcap. The titeInhibit resource
removes the ti and te strings from the TERMCAP string which is set in
the environment for some platforms. That is not done when xterm is
built with terminfo libraries because terminfo does not provide the
whole text of the termcap data in one piece. It would not work for
terminfo anyway, since terminfo data is not passed in environment
variables; setting an environment variable in this manner would have no
effect on the application's ability to switch between Normal and
Alternate Screen buffers. Instead, the newer private mode controls
(such as 1 0 4 9 ) for switching between Normal and Alternate Screen
buffers simply disable the switching. They add other features such as
clearing the display for the same reason: to make the details of
switching independent of the application that requests the switch.