Added smarter display routine

This commit is contained in:
Keith Winstein
2011-02-05 02:55:30 -05:00
parent 225ddbe2bf
commit a54cc9d0c4
6 changed files with 179 additions and 6 deletions
+3 -2
View File
@@ -166,6 +166,7 @@ void emulate_terminal( int fd, int debug_fd )
/* open parser and terminal */
Parser::UTF8Parser parser;
Terminal::Emulator terminal( window_size.ws_col, window_size.ws_row );
struct pollfd pollfds[ 3 ];
pollfds[ 0 ].fd = STDIN_FILENO;
@@ -194,6 +195,8 @@ void emulate_terminal( int fd, int debug_fd )
if ( termemu( fd, fd, false, debug_fd, &parser, &terminal ) < 0 ) {
break;
}
std::string update = terminal.new_frame();
swrite( STDOUT_FILENO, update.c_str() );
} else if ( pollfds[ 2 ].revents & POLLIN ) {
/* resize */
struct signalfd_siginfo info;
@@ -269,8 +272,6 @@ int termemu( int host_fd, int src_fd, bool user, int debug_fd,
}
}
terminal->debug_printout( STDOUT_FILENO );
/* write writeback */
std::string terminal_to_host = terminal->read_octets_to_host();
return swrite( host_fd, terminal_to_host.c_str(), terminal_to_host.length() );