diff options
author | John Hood <cgull@glup.org> | 2015-10-24 23:07:38 -0400 |
---|---|---|
committer | John Hood <cgull@glup.org> | 2015-12-06 17:47:11 -0500 |
commit | 81f21fc7acff783732417bfcf8b88d012431f51c (patch) | |
tree | 16c56fef64afe8be2137ad1d07719ab9029d7c7b | |
parent | 1e003b0e76f8372243f2886a9fb2bf7dbc45016a (diff) |
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.
-rw-r--r-- | src/statesync/completeterminal.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/statesync/completeterminal.cc b/src/statesync/completeterminal.cc index d65ff9d..c22c6d0 100644 --- a/src/statesync/completeterminal.cc +++ b/src/statesync/completeterminal.cc @@ -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_height( terminal.get_fb().ds.get_height() ); } - Instruction *new_inst = output.add_instruction(); - new_inst->MutableExtension( hostbytes )->set_hoststring( display.new_frame( true, existing.get_fb(), terminal.get_fb() ) ); + string update = display.new_frame( true, existing.get_fb(), terminal.get_fb() ); + if ( !update.empty() ) { + Instruction *new_inst = output.add_instruction(); + new_inst->MutableExtension( hostbytes )->set_hoststring( update ); + } } return output.SerializeAsString(); |