Simplify some conditionals in terminaloverlay.cc.

This commit is contained in:
John Hood
2017-05-06 22:59:37 -04:00
parent 42d2b5d029
commit 2b724d5868
+8 -6
View File
@@ -240,7 +240,8 @@ void NotificationEngine::apply( Framebuffer &fb ) const
if ( message.empty() && (!time_expired) ) { if ( message.empty() && (!time_expired) ) {
return; return;
} else if ( message.empty() && time_expired ) { }
if ( message.empty() && time_expired ) {
swprintf( tmp, 128, L"mosh: Last %s %s ago.%s", explanation, swprintf( tmp, 128, L"mosh: Last %s %s ago.%s", explanation,
human_readable_duration( static_cast<int>( time_elapsed ), human_readable_duration( static_cast<int>( time_elapsed ),
"seconds" ).c_str(), "seconds" ).c_str(),
@@ -361,12 +362,13 @@ void ConditionalOverlayRow::apply( Framebuffer &fb, uint64_t confirmed_epoch, bo
void PredictionEngine::apply( Framebuffer &fb ) const void PredictionEngine::apply( Framebuffer &fb ) const
{ {
bool show = (display_preference != Never) && ( srtt_trigger if ( (display_preference == Never) || !( srtt_trigger
|| glitch_trigger || glitch_trigger
|| (display_preference == Always) || (display_preference == Always)
|| (display_preference == Experimental) ); || (display_preference == Experimental) ) ){
return;
}
if ( show ) {
for ( cursors_type::const_iterator it = cursors.begin(); for ( cursors_type::const_iterator it = cursors.begin();
it != cursors.end(); it != cursors.end();
it++ ) { it++ ) {
@@ -379,7 +381,6 @@ void PredictionEngine::apply( Framebuffer &fb ) const
it->apply( fb, confirmed_epoch, flagging ); it->apply( fb, confirmed_epoch, flagging );
} }
} }
}
void PredictionEngine::kill_epoch( uint64_t epoch, const Framebuffer &fb ) void PredictionEngine::kill_epoch( uint64_t epoch, const Framebuffer &fb )
{ {
@@ -651,7 +652,8 @@ void PredictionEngine::new_user_byte( char the_byte, const Framebuffer &fb )
{ {
if ( display_preference == Never ) { if ( display_preference == Never ) {
return; return;
} else if ( display_preference == Experimental ) { }
if ( display_preference == Experimental ) {
prediction_epoch = confirmed_epoch; prediction_epoch = confirmed_epoch;
} }