diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index ee60ff4840..4822917f28 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -80,6 +80,9 @@ /* Erase characters until the end of the line */ #define ANSI_ERASE_TO_END_OF_LINE "\x1B[K" +/* Erase characters until end of screen */ +#define ANSI_ERASE_TO_END_OF_SCREEN "\x1B[J" + /* Move cursor up one line */ #define ANSI_REVERSE_LINEFEED "\x1BM" diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index 03660ad417..c05ce79489 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -115,7 +115,7 @@ static void pty_forward_disconnect(PTYForward *f) { (void) fd_nonblock(f->output_fd, false); if (colors_enabled()) - (void) loop_write(f->output_fd, ANSI_NORMAL ANSI_ERASE_TO_END_OF_LINE, SIZE_MAX); + (void) loop_write(f->output_fd, ANSI_NORMAL ANSI_ERASE_TO_END_OF_SCREEN, SIZE_MAX); if (f->close_output_fd) f->output_fd = safe_close(f->output_fd);