From 2873def506f3ee0a16ed7ed5636d676524b7d4d4 Mon Sep 17 00:00:00 2001 From: John Hood Date: Sun, 26 Mar 2017 21:27:38 -0400 Subject: [PATCH] Work around JuiceSSH rendering bug JuiceSSH apparently has a bug where ECH for one character (ESC [ 1 X) does not actually erase the character, in its code that receives and interprets Mosh state updates. This was hidden before because Mosh <= 1.2.5 never sent this sequence, it sent ESC [ X instead as an optimization. Do the better optimization of sending spaces for short sequences of blanks instead. --- src/terminal/terminaldisplay.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/terminal/terminaldisplay.cc b/src/terminal/terminaldisplay.cc index 81fbd9f..74d662e 100644 --- a/src/terminal/terminaldisplay.cc +++ b/src/terminal/terminaldisplay.cc @@ -386,7 +386,7 @@ bool Display::put_row( bool initialized, FrameState &frame, const Framebuffer &f frame.append_silent_move( frame_y, frame_x - clear_count ); frame.update_rendition( blank_renditions ); bool can_use_erase = has_bce || ( frame.current_rendition == initial_rendition() ); - if ( can_use_erase && has_ech ) { + if ( can_use_erase && has_ech && clear_count > 4 ) { snprintf( tmp, 64, "\033[%dX", clear_count ); frame.append( tmp ); } else { @@ -436,8 +436,8 @@ bool Display::put_row( bool initialized, FrameState &frame, const Framebuffer &f frame.append_silent_move( frame_y, frame_x - clear_count ); frame.update_rendition( blank_renditions ); - bool can_use_erase = !wrap_this && ( has_bce || ( frame.current_rendition == initial_rendition() ) ); - if ( can_use_erase ) { + bool can_use_erase = has_bce || ( frame.current_rendition == initial_rendition() ); + if ( can_use_erase && !wrap_this ) { frame.append( "\033[K" ); } else { frame.append( clear_count, ' ' );