Make cursor visible after client termination

For complex interactive application it is recommended to run them
under dvtm as in:

 $ abduco -c demo dvtm [your-fancy-app]
This commit is contained in:
Marc André Tanner 2016-01-07 13:26:02 +01:00
parent 4d80fccaa4
commit f7b65db3ca
2 changed files with 4 additions and 4 deletions

View File

@ -23,9 +23,9 @@ static bool client_recv_packet(Packet *pkt) {
static void client_restore_terminal(void) { static void client_restore_terminal(void) {
if (has_term) if (has_term)
tcsetattr(STDIN_FILENO, TCSADRAIN, &orig_term); tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_term);
if (alternate_buffer) { if (alternate_buffer) {
printf("\033[?1049l"); printf("\033[?25h\033[?1049l");
fflush(stdout); fflush(stdout);
alternate_buffer = false; alternate_buffer = false;
} }
@ -43,7 +43,7 @@ static void client_setup_terminal(void) {
cur_term.c_cc[VLNEXT] = _POSIX_VDISABLE; cur_term.c_cc[VLNEXT] = _POSIX_VDISABLE;
cur_term.c_cc[VMIN] = 1; cur_term.c_cc[VMIN] = 1;
cur_term.c_cc[VTIME] = 0; cur_term.c_cc[VTIME] = 0;
tcsetattr(STDIN_FILENO, TCSADRAIN, &cur_term); tcsetattr(STDIN_FILENO, TCSANOW, &cur_term);
if (!alternate_buffer) { if (!alternate_buffer) {
printf("\033[?1049h\033[H"); printf("\033[?1049h\033[H");

View File

@ -36,7 +36,7 @@ expected_abduco_prolog() {
# $1 => session-name, $2 => exit status # $1 => session-name, $2 => exit status
expected_abduco_epilog() { expected_abduco_epilog() {
echo "[?1049labduco: $1: session terminated with exit status $2" echo "[?25h[?1049labduco: $1: session terminated with exit status $2"
} }
# $1 => session-name, $2 => cmd to run # $1 => session-name, $2 => cmd to run