From ebe95dd2ae16dfd66044322aac73579693079c50 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Mon, 31 Jan 2011 22:51:41 -0500 Subject: [PATCH] Fix bug in state diagram, and handle VT. Now passes screens 1 and 2 of vttest --- parserstate.cpp | 4 ++++ terminal.cpp | 7 ++++++- terminalfunctions.cpp | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/parserstate.cpp b/parserstate.cpp index ea6be4c..bb051bb 100644 --- a/parserstate.cpp +++ b/parserstate.cpp @@ -166,6 +166,10 @@ Transition CSI_Entry::input_state_rule( wchar_t ch ) Transition CSI_Param::input_state_rule( wchar_t ch ) { + if ( C0_prime( ch ) ) { + return Transition( new Execute ); + } + if ( ( (0x30 <= ch) && (ch <= 0x39) ) || ( ch == 0x3B ) ) { return Transition( new Param ); } diff --git a/terminal.cpp b/terminal.cpp index eeaf71e..1481ea4 100644 --- a/terminal.cpp +++ b/terminal.cpp @@ -29,7 +29,12 @@ std::string Emulator::input( char c, int actfd ) /* print out debugging information */ if ( (actfd > 0) && ( !act->handled ) ) { char actsum[ 64 ]; - snprintf( actsum, 64, "%s%s ", act->str().c_str(), dispatch.str().c_str() ); + if ( (typeid( *act ) == typeid( Parser::CSI_Dispatch )) + || (typeid( *act ) == typeid( Parser::Esc_Dispatch )) ) { + snprintf( actsum, 64, "%s%s ", act->str().c_str(), dispatch.str().c_str() ); + } else { + snprintf( actsum, 64, "%s ", act->str().c_str() ); + } swrite( actfd, actsum ); } delete act; diff --git a/terminalfunctions.cpp b/terminalfunctions.cpp index 1cc97a1..9ebb970 100644 --- a/terminalfunctions.cpp +++ b/terminalfunctions.cpp @@ -118,8 +118,11 @@ void Ctrl_LF( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) fb->move_rows_autoscroll( 1 ); } +/* same procedure for index, vertical tab, and form feed control codes */ static Function func_Ctrl_LF( CONTROL, "\x0a", Ctrl_LF ); static Function func_Ctrl_IND( CONTROL, "\x84", Ctrl_LF ); +static Function func_Ctrl_VT( CONTROL, "\x0b", Ctrl_LF ); +static Function func_Ctrl_FF( CONTROL, "\x0c", Ctrl_LF ); /* carriage return */ void Ctrl_CR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) @@ -137,7 +140,7 @@ void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) static Function func_Ctrl_BS( CONTROL, "\x08", Ctrl_BS ); -/* reverse index -- like a backwards linefeed */ +/* reverse index -- like a backwards line feed */ void Ctrl_RI( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->move_rows_autoscroll( -1 );