Fix bugs in resize handling.

* A resize action could be applied to the framebuffer but discarded
  before being applied to termios, causing them to be out of sync.

* Only every second action was skipped, instead of skipping
  consecutive resize actions, as intended.

Found by inspection, not seen in actual usage or by the window-resize
test.
This commit is contained in:
John Hood
2015-12-10 22:23:29 -05:00
parent 255dc39c9f
commit d4832ca63a
+4 -4
View File
@@ -663,12 +663,11 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
/* apply userstream to terminal */ /* apply userstream to terminal */
for ( size_t i = 0; i < us.size(); i++ ) { for ( size_t i = 0; i < us.size(); i++ ) {
const Parser::Action *action = us.get_action( i ); const Parser::Action *action = us.get_action( i );
terminal_to_host += terminal.act( action );
if ( typeid( *action ) == typeid( Parser::Resize ) ) { if ( typeid( *action ) == typeid( Parser::Resize ) ) {
/* elide consecutive Resize actions */ /* apply only the last consecutive Resize action */
if ( i < us.size() - 1 && while ( i < us.size() - 1 &&
typeid( us.get_action( i + 1 ) ) == typeid( Parser::Resize ) ) { typeid( us.get_action( i + 1 ) ) == typeid( Parser::Resize ) ) {
continue; i++;
} }
/* tell child process of resize */ /* tell child process of resize */
const Parser::Resize *res = static_cast<const Parser::Resize *>( action ); const Parser::Resize *res = static_cast<const Parser::Resize *>( action );
@@ -684,6 +683,7 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
return; return;
} }
} }
terminal_to_host += terminal.act( action );
} }
if ( !us.empty() ) { if ( !us.empty() ) {