Implement back color erase
This commit is contained in:
@@ -123,6 +123,8 @@ void Emulator::Esc_dispatch( Parser::Esc_Dispatch *act )
|
|||||||
|
|
||||||
void Emulator::debug_printout( int fd )
|
void Emulator::debug_printout( int fd )
|
||||||
{
|
{
|
||||||
|
fb.back_color_erase();
|
||||||
|
|
||||||
std::string screen;
|
std::string screen;
|
||||||
screen.append( "\033[H" );
|
screen.append( "\033[H" );
|
||||||
|
|
||||||
|
|||||||
+35
-1
@@ -8,7 +8,8 @@ Cell::Cell()
|
|||||||
: contents(),
|
: contents(),
|
||||||
fallback( false ),
|
fallback( false ),
|
||||||
width( 1 ),
|
width( 1 ),
|
||||||
renditions()
|
renditions(),
|
||||||
|
need_back_color_erase( true )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Row::Row( size_t s_width )
|
Row::Row( size_t s_width )
|
||||||
@@ -21,6 +22,7 @@ void Cell::reset( void )
|
|||||||
fallback = false;
|
fallback = false;
|
||||||
width = 1;
|
width = 1;
|
||||||
renditions.clear();
|
renditions.clear();
|
||||||
|
need_back_color_erase = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawState::DrawState( int s_width, int s_height )
|
DrawState::DrawState( int s_width, int s_height )
|
||||||
@@ -247,6 +249,7 @@ std::vector<int> DrawState::get_tabs( void )
|
|||||||
|
|
||||||
void Framebuffer::apply_renditions_to_current_cell( void )
|
void Framebuffer::apply_renditions_to_current_cell( void )
|
||||||
{
|
{
|
||||||
|
get_cell()->need_back_color_erase = false;
|
||||||
get_cell()->renditions = ds.get_renditions();
|
get_cell()->renditions = ds.get_renditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,3 +392,34 @@ void DrawState::resize( int s_width, int s_height )
|
|||||||
combining_char_col = combining_char_row = -1;
|
combining_char_col = combining_char_row = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DrawState::get_background_rendition( void )
|
||||||
|
{
|
||||||
|
int color = 0;
|
||||||
|
for ( std::vector<int>::iterator i = renditions.begin();
|
||||||
|
i != renditions.end();
|
||||||
|
i++ ) {
|
||||||
|
int r = *i;
|
||||||
|
if ( (40 <= r) && (r <= 47) ) {
|
||||||
|
color = r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Framebuffer::back_color_erase( void )
|
||||||
|
{
|
||||||
|
int bg_color = ds.get_background_rendition();
|
||||||
|
|
||||||
|
for ( int row = 0; row < ds.get_height(); row++ ) {
|
||||||
|
for ( int col = 0; col < ds.get_width(); col++ ) {
|
||||||
|
Cell *cell = get_cell( row, col );
|
||||||
|
if ( cell->need_back_color_erase ) {
|
||||||
|
assert( cell->renditions.empty() );
|
||||||
|
cell->renditions.push_back( bg_color );
|
||||||
|
cell->need_back_color_erase = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace Terminal {
|
|||||||
char fallback; /* first character is combining character */
|
char fallback; /* first character is combining character */
|
||||||
int width;
|
int width;
|
||||||
std::vector<int> renditions; /* e.g., bold, blinking, etc. */
|
std::vector<int> renditions; /* e.g., bold, blinking, etc. */
|
||||||
|
bool need_back_color_erase;
|
||||||
|
|
||||||
Cell();
|
Cell();
|
||||||
|
|
||||||
@@ -99,6 +100,7 @@ namespace Terminal {
|
|||||||
void clear_renditions( void ) { renditions.clear(); }
|
void clear_renditions( void ) { renditions.clear(); }
|
||||||
void add_rendition( int x ) { renditions.push_back( x ); }
|
void add_rendition( int x ) { renditions.push_back( x ); }
|
||||||
const std::vector<int> get_renditions( void ) { return renditions; }
|
const std::vector<int> get_renditions( void ) { return renditions; }
|
||||||
|
int get_background_rendition( void );
|
||||||
|
|
||||||
void save_cursor( void );
|
void save_cursor( void );
|
||||||
void restore_cursor( void );
|
void restore_cursor( void );
|
||||||
@@ -141,6 +143,8 @@ namespace Terminal {
|
|||||||
std::vector<wchar_t> get_window_title( void ) { return window_title; }
|
std::vector<wchar_t> get_window_title( void ) { return window_title; }
|
||||||
|
|
||||||
void resize( int s_width, int s_height );
|
void resize( int s_width, int s_height );
|
||||||
|
|
||||||
|
void back_color_erase( void );
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -312,6 +312,8 @@ static Function func_Ctrl_BEL( CONTROL, "\x07", Ctrl_BEL );
|
|||||||
/* select graphics rendition -- e.g., bold, blinking, etc. */
|
/* select graphics rendition -- e.g., bold, blinking, etc. */
|
||||||
void CSI_SGR( Framebuffer *fb, Dispatcher *dispatch )
|
void CSI_SGR( Framebuffer *fb, Dispatcher *dispatch )
|
||||||
{
|
{
|
||||||
|
fb->back_color_erase();
|
||||||
|
|
||||||
for ( int i = 0; i < dispatch->param_count(); i++ ) {
|
for ( int i = 0; i < dispatch->param_count(); i++ ) {
|
||||||
int rendition = dispatch->getparam( i, 0 );
|
int rendition = dispatch->getparam( i, 0 );
|
||||||
if ( rendition == 0 ) {
|
if ( rendition == 0 ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user