Now passes first vttest test (implemented RI and NEL)

This commit is contained in:
Keith Winstein
2011-01-31 05:35:12 -05:00
parent 30f03a52f6
commit e4dce8f6e2
2 changed files with 29 additions and 5 deletions
+15 -5
View File
@@ -66,12 +66,20 @@ Framebuffer::Framebuffer( int s_width, int s_height )
void Framebuffer::scroll( int N )
{
assert( N >= 0 );
if ( N >= 0 ) {
for ( int i = 0; i < N; i++ ) {
rows.pop_front();
rows.push_back( Row( ds.get_width() ) );
ds.move_row( -1, true );
}
} else {
N = -N;
for ( int i = 0; i < N; i++ ) {
rows.pop_front();
rows.push_back( Row( ds.get_width() ) );
ds.move_row( -1, true );
for ( int i = 0; i < N; i++ ) {
rows.pop_back();
rows.push_front( Row( ds.get_width() ) );
ds.move_row( 1, true );
}
}
}
@@ -129,6 +137,8 @@ void Framebuffer::move_rows_autoscroll( int rows )
{
if ( ds.get_cursor_row() + rows >= ds.get_height() ) {
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 );
+14
View File
@@ -127,3 +127,17 @@ void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
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 );