Improve redrawing of screen

This commit is contained in:
Michael Krayer 2025-04-08 14:15:05 +02:00
parent 748020b2fa
commit 82ffbac28b
1 changed files with 11 additions and 7 deletions

View File

@ -40,8 +40,8 @@ restore_term(void)
tcsetattr(0, TCSADRAIN, &orig_term);
/* Make cursor visible. Assumes VT100. */
printf("\033[?25h");
fflush(stdout);
printf("\033[?25h\033[?1049l");
fflush(stdout);
}
/* Connects to a unix domain socket */
@ -214,7 +214,9 @@ attach_main(int noerror)
tcsetattr(0, TCSADRAIN, &cur_term);
/* Clear the screen. This assumes VT100. */
write(1, "\33[H\33[J", 6);
printf("\033[?1049h\033[H");
fflush(stdout);
/* write(1, "\33[H\33[J", 6); */
/* Tell the master that we want to attach. */
memset(&pkt, 0, sizeof(struct packet));
@ -238,7 +240,8 @@ attach_main(int noerror)
n = select(s + 1, &readfds, NULL, NULL, NULL);
if (n < 0 && errno != EINTR && errno != EAGAIN)
{
printf(EOS "\r\n[select failed]\r\n");
restore_term();
printf(EOS "[select failed]\r\n");
exit(1);
}
@ -249,13 +252,14 @@ attach_main(int noerror)
if (len == 0)
{
printf(EOS "\r\n[EOF - dtach terminating]"
"\r\n");
restore_term();
printf(EOS "[EOF - dtach terminating]\r\n");
exit(0);
}
else if (len < 0)
{
printf(EOS "\r\n[read returned an error]\r\n");
restore_term();
printf(EOS "[read returned an error]\r\n");
exit(1);
}
/* Send the data to the terminal. */