Don't send empty HostBytes strings.

This allows more Resize instructions to be elided.  It also keeps the
server from sending empty updates when the screen has been written but
not changed.
This commit is contained in:
John Hood
2015-10-24 23:07:38 -04:00
parent 1e003b0e76
commit 81f21fc7ac
+4 -1
View File
@@ -87,8 +87,11 @@ string Complete::diff_from( const Complete &existing ) const
new_res->MutableExtension( resize )->set_width( terminal.get_fb().ds.get_width() ); new_res->MutableExtension( resize )->set_width( terminal.get_fb().ds.get_width() );
new_res->MutableExtension( resize )->set_height( terminal.get_fb().ds.get_height() ); new_res->MutableExtension( resize )->set_height( terminal.get_fb().ds.get_height() );
} }
string update = display.new_frame( true, existing.get_fb(), terminal.get_fb() );
if ( !update.empty() ) {
Instruction *new_inst = output.add_instruction(); Instruction *new_inst = output.add_instruction();
new_inst->MutableExtension( hostbytes )->set_hoststring( display.new_frame( true, existing.get_fb(), terminal.get_fb() ) ); new_inst->MutableExtension( hostbytes )->set_hoststring( update );
}
} }
return output.SerializeAsString(); return output.SerializeAsString();