Now passes first vttest test (implemented RI and NEL)
This commit is contained in:
+12
-2
@@ -66,13 +66,21 @@ Framebuffer::Framebuffer( int s_width, int s_height )
|
|||||||
|
|
||||||
void Framebuffer::scroll( int N )
|
void Framebuffer::scroll( int N )
|
||||||
{
|
{
|
||||||
assert( N >= 0 );
|
if ( N >= 0 ) {
|
||||||
|
|
||||||
for ( int i = 0; i < N; i++ ) {
|
for ( int i = 0; i < N; i++ ) {
|
||||||
rows.pop_front();
|
rows.pop_front();
|
||||||
rows.push_back( Row( ds.get_width() ) );
|
rows.push_back( Row( ds.get_width() ) );
|
||||||
ds.move_row( -1, true );
|
ds.move_row( -1, true );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
N = -N;
|
||||||
|
|
||||||
|
for ( int i = 0; i < N; i++ ) {
|
||||||
|
rows.pop_back();
|
||||||
|
rows.push_front( Row( ds.get_width() ) );
|
||||||
|
ds.move_row( 1, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawState::new_grapheme( void )
|
void DrawState::new_grapheme( void )
|
||||||
@@ -129,6 +137,8 @@ void Framebuffer::move_rows_autoscroll( int rows )
|
|||||||
{
|
{
|
||||||
if ( ds.get_cursor_row() + rows >= ds.get_height() ) {
|
if ( ds.get_cursor_row() + rows >= ds.get_height() ) {
|
||||||
scroll( ds.get_height() - ds.get_cursor_row() - rows + 1 );
|
scroll( ds.get_height() - ds.get_cursor_row() - rows + 1 );
|
||||||
|
} else if ( ds.get_cursor_row() + rows < 0 ) {
|
||||||
|
scroll( ds.get_cursor_row() + rows );
|
||||||
}
|
}
|
||||||
|
|
||||||
ds.move_row( rows, true );
|
ds.move_row( rows, true );
|
||||||
|
|||||||
@@ -127,3 +127,17 @@ void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
|
|
||||||
static Function func_Ctrl_BS( CONTROL, "\x08", Ctrl_BS );
|
static Function func_Ctrl_BS( CONTROL, "\x08", Ctrl_BS );
|
||||||
|
|
||||||
|
void Ctrl_RI( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
|
{
|
||||||
|
fb->move_rows_autoscroll( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static Function func_Ctrl_RI( CONTROL, "\x8D", Ctrl_RI );
|
||||||
|
|
||||||
|
void Ctrl_NEL( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
|
{
|
||||||
|
fb->ds.move_col( 0 );
|
||||||
|
fb->move_rows_autoscroll( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static Function func_Ctrl_NEL( CONTROL, "\x85", Ctrl_NEL );
|
||||||
|
|||||||
Reference in New Issue
Block a user