Insert cell / delete cell. Now usable under xterm TERM
This commit is contained in:
@@ -58,10 +58,6 @@ void Emulator::print( Parser::Print *act )
|
||||
|
||||
Cell *this_cell = fb.get_cell();
|
||||
|
||||
if ( !this_cell ) { /* zero-size framebuffer */
|
||||
return;
|
||||
}
|
||||
|
||||
Cell *combining_cell = fb.get_combining_cell();
|
||||
|
||||
switch ( chwidth ) {
|
||||
|
||||
+20
-7
@@ -145,9 +145,8 @@ void Framebuffer::move_rows_autoscroll( int rows )
|
||||
|
||||
Cell *Framebuffer::get_cell( void )
|
||||
{
|
||||
if ( (ds.get_width() == 0) || (ds.get_height() == 0) ) {
|
||||
return NULL;
|
||||
}
|
||||
assert( ds.get_width() );
|
||||
assert( ds.get_height() );
|
||||
|
||||
return &rows[ ds.get_cursor_row() ].cells[ ds.get_cursor_col() ];
|
||||
}
|
||||
@@ -232,10 +231,7 @@ std::vector<int> DrawState::get_tabs( void )
|
||||
|
||||
void Framebuffer::apply_renditions_to_current_cell( void )
|
||||
{
|
||||
Cell *this_cell = get_cell();
|
||||
assert( this_cell );
|
||||
|
||||
this_cell->renditions = ds.get_renditions();
|
||||
get_cell()->renditions = ds.get_renditions();
|
||||
}
|
||||
|
||||
SavedCursor::SavedCursor()
|
||||
@@ -291,4 +287,21 @@ void Framebuffer::delete_line( int row )
|
||||
void Row::insert_cell( int col )
|
||||
{
|
||||
cells.insert( cells.begin() + col, Cell() );
|
||||
cells.erase( cells.end() - 1 );
|
||||
}
|
||||
|
||||
void Row::delete_cell( int col )
|
||||
{
|
||||
cells.erase( cells.begin() + col );
|
||||
cells.push_back( Cell() );
|
||||
}
|
||||
|
||||
void Framebuffer::insert_cell( int row, int col )
|
||||
{
|
||||
rows[ row ].insert_cell( col );
|
||||
}
|
||||
|
||||
void Framebuffer::delete_cell( int row, int col )
|
||||
{
|
||||
rows[ row ].delete_cell( col );
|
||||
}
|
||||
|
||||
@@ -123,6 +123,9 @@ namespace Terminal {
|
||||
|
||||
void insert_line( int before_row );
|
||||
void delete_line( int row );
|
||||
|
||||
void insert_cell( int row, int col );
|
||||
void delete_cell( int row, int col );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -341,3 +341,28 @@ void CSI_DL( Framebuffer *fb, Dispatcher *dispatch )
|
||||
}
|
||||
|
||||
static Function func_CSI_DL( CSI, "M", CSI_DL );
|
||||
|
||||
/* insert characters */
|
||||
void CSI_ICH( Framebuffer *fb, Dispatcher *dispatch )
|
||||
{
|
||||
int cells = dispatch->getparam( 0, 1 );
|
||||
|
||||
for ( int i = 0; i < cells; i++ ) {
|
||||
fb->insert_cell( fb->ds.get_cursor_row(), fb->ds.get_cursor_col() );
|
||||
}
|
||||
}
|
||||
|
||||
static Function func_CSI_ICH( CSI, "@", CSI_ICH );
|
||||
|
||||
/* delete character */
|
||||
void CSI_DCH( Framebuffer *fb, Dispatcher *dispatch )
|
||||
{
|
||||
int cells = dispatch->getparam( 0, 1 );
|
||||
|
||||
for ( int i = 0; i < cells; i++ ) {
|
||||
fb->delete_cell( fb->ds.get_cursor_row(), fb->ds.get_cursor_col() );
|
||||
}
|
||||
}
|
||||
|
||||
static Function func_CSI_DCH( CSI, "P", CSI_DCH );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user