From 63d2f5ce42645360dae677ca11daf2ae3c61dd46 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Fri, 4 Feb 2011 02:04:09 -0500 Subject: [PATCH] Support reverse video. --- terminal.cpp | 5 +++++ terminalframebuffer.cpp | 3 ++- terminalframebuffer.hpp | 1 + terminalfunctions.cpp | 4 +++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/terminal.cpp b/terminal.cpp index 25b08e8..216d7b4 100644 --- a/terminal.cpp +++ b/terminal.cpp @@ -138,6 +138,11 @@ void Emulator::debug_printout( int fd ) } screen.append( "\033\\" ); + /* set reverse video */ + char rev[ 8 ]; + snprintf( rev, 8, "\033[?5%c", (fb.ds.reverse_video ? 'h' : 'l') ); + screen.append( rev ); + for ( int y = 0; y < fb.ds.get_height(); y++ ) { for ( int x = 0; x < fb.ds.get_width(); /* let charwidth handle advance */ ) { char curmove[ 32 ]; diff --git a/terminalframebuffer.cpp b/terminalframebuffer.cpp index f217477..dd0d414 100644 --- a/terminalframebuffer.cpp +++ b/terminalframebuffer.cpp @@ -47,7 +47,8 @@ DrawState::DrawState( int s_width, int s_height ) scrolling_region_top_row( 0 ), scrolling_region_bottom_row( height - 1 ), renditions(), save(), next_print_will_wrap( false ), origin_mode( false ), auto_wrap_mode( true ), - insert_mode( false ), cursor_visible( true ), application_mode_cursor_keys( false ) + insert_mode( false ), cursor_visible( true ), reverse_video( false ), + application_mode_cursor_keys( false ) { for ( int i = 0; i < width; i++ ) { tabs[ i ] = ( (i % 8) == 0 ); diff --git a/terminalframebuffer.hpp b/terminalframebuffer.hpp index aca8bcb..f21a92e 100644 --- a/terminalframebuffer.hpp +++ b/terminalframebuffer.hpp @@ -69,6 +69,7 @@ namespace Terminal { bool auto_wrap_mode; bool insert_mode; bool cursor_visible; + bool reverse_video; bool application_mode_cursor_keys; diff --git a/terminalfunctions.cpp b/terminalfunctions.cpp index 186c587..62d5c42 100644 --- a/terminalfunctions.cpp +++ b/terminalfunctions.cpp @@ -210,7 +210,7 @@ static bool *get_DEC_mode( int param, Framebuffer *fb ) { switch ( param ) { case 1: /* cursor key mode */ return &(fb->ds.application_mode_cursor_keys); - case 3: /* 80/132 */ + case 3: /* 80/132. Ignore but clear screen. */ /* clear screen */ fb->ds.move_row( 0 ); fb->ds.move_col( 0 ); @@ -218,6 +218,8 @@ static bool *get_DEC_mode( int param, Framebuffer *fb ) { clearline( fb, y, 0, fb->ds.get_width() - 1 ); } return NULL; + case 5: /* reverse video */ + return &(fb->ds.reverse_video); case 6: /* origin */ fb->ds.move_row( 0 ); fb->ds.move_col( 0 );