Remove some debugging routines and add comments

This commit is contained in:
Keith Winstein
2011-02-06 14:43:47 -05:00
parent bab3f90e2b
commit 1ee54cd70a
4 changed files with 28 additions and 100 deletions
-69
View File
@@ -121,75 +121,6 @@ void Emulator::Esc_dispatch( Parser::Esc_Dispatch *act )
}
}
void Emulator::debug_printout( int fd )
{
fb.back_color_erase();
std::string screen;
/* set window title */
screen.append( "\033]0;[rtm] " );
std::vector<wchar_t> window_title = fb.get_window_title();
for ( std::vector<wchar_t>::iterator i = window_title.begin();
i != window_title.end();
i++ ) {
char utf8[ 8 ];
snprintf( utf8, 8, "%lc", *i );
screen.append( utf8 );
}
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 ];
snprintf( curmove, 32, "\033[%d;%dH", y + 1, x + 1 );
screen.append( curmove );
Cell *cell = fb.get_cell( y, x );
/* print renditions */
screen.append( cell->renditions.sgr() );
/* clear cell */
screen.append( "\033[X" );
/* print cell contents */
/* cells that begin with combining character get combiner attached to no-break space */
if ( cell->fallback ) {
char utf8[ 8 ];
snprintf( utf8, 8, "%lc", 0xA0 );
screen.append( utf8 );
}
for ( std::vector<wchar_t>::iterator i = cell->contents.begin();
i != cell->contents.end();
i++ ) {
char utf8[ 8 ];
snprintf( utf8, 8, "%lc", *i );
screen.append( utf8 );
}
x += cell->width;
}
}
char curmove[ 32 ];
if ( fb.ds.cursor_visible ) {
snprintf( curmove, 32, "\033[?25h\033[%d;%dH", fb.ds.get_cursor_row() + 1,
fb.ds.get_cursor_col() + 1 );
} else {
snprintf( curmove, 32, "\033[?25l" );
}
screen.append( curmove );
swrite( fd, screen.c_str() );
}
std::string Emulator::open( void )
{
char appmode[ 6 ] = { 0x1b, '[', '?', '1', 'h', 0 };