Put the real terminal in alternate screen mode
Closes #2 Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Keith Winstein
parent
2ae960f7f0
commit
ed42d31bda
@@ -46,12 +46,12 @@ static const Renditions & initial_rendition( void )
|
|||||||
|
|
||||||
std::string Display::open() const
|
std::string Display::open() const
|
||||||
{
|
{
|
||||||
return std::string( "\033[?1h" );
|
return std::string( smcup ? smcup : "" ) + std::string( "\033[?1h" );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Display::close() const
|
std::string Display::close() const
|
||||||
{
|
{
|
||||||
return std::string( "\033[?1l\033[0m\033[?25h" );
|
return std::string( "\033[?1l\033[0m\033[?25h" ) + std::string( rmcup ? rmcup : "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Display::new_frame( bool initialized, const Framebuffer &last, const Framebuffer &f ) const
|
std::string Display::new_frame( bool initialized, const Framebuffer &last, const Framebuffer &f ) const
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ namespace Terminal {
|
|||||||
|
|
||||||
int posterize_colors; /* downsample input colors >8 to [0..7] */
|
int posterize_colors; /* downsample input colors >8 to [0..7] */
|
||||||
|
|
||||||
|
const char *smcup, *rmcup; /* enter and exit alternate screen mode */
|
||||||
|
|
||||||
void put_cell( bool initialized, FrameState &frame, const Framebuffer &f ) const;
|
void put_cell( bool initialized, FrameState &frame, const Framebuffer &f ) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ const char *Display::ti_str( const char *capname ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Display::Display( bool use_environment )
|
Display::Display( bool use_environment )
|
||||||
: has_ech( true ), has_bce( true ), has_title( true ), posterize_colors( false )
|
: has_ech( true ), has_bce( true ), has_title( true ), posterize_colors( false ), smcup( NULL ), rmcup( NULL )
|
||||||
{
|
{
|
||||||
if ( use_environment ) {
|
if ( use_environment ) {
|
||||||
int errret = -2;
|
int errret = -2;
|
||||||
@@ -145,5 +145,8 @@ Display::Display( bool use_environment )
|
|||||||
/*
|
/*
|
||||||
posterize_colors = ti_num( "colors" ) < 256;
|
posterize_colors = ti_num( "colors" ) < 256;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
smcup = ti_str("smcup");
|
||||||
|
rmcup = ti_str("rmcup");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user