Put the real terminal in alternate screen mode

Closes #2

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2013-01-27 20:38:30 -05:00
committed by Keith Winstein
parent 2ae960f7f0
commit ed42d31bda
3 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -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
+2
View File
@@ -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:
+4 -1
View File
@@ -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");
} }
} }