diff --git a/src/nano.c b/src/nano.c index 4fe35081..81ba8f0d 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1242,8 +1242,28 @@ RETSIGTYPE do_suspend(int signal) tcsetattr(0, TCSANOW, &oldterm); #ifdef SIGSTOP + turnover: /* Do what mutt does: send ourselves a SIGSTOP. */ kill(0, SIGSTOP); + + /* If the keyboard is not connected, go back to sleep. */ + if (ttyname(0) == NULL) + goto turnover; +#endif + +#ifdef ENABLE_MOUSE + if (ISSET(USE_MOUSE)) + enable_mouse_support(); +#endif + +#ifndef NANO_TINY + /* Perhaps the user resized the window while we slept. So act as if, + * and restore the terminal to its previous state in the process. */ + regenerate_screen(); +#else + /* Restore the state of the terminal and redraw the whole screen. */ + terminal_init(); + total_refresh(); #endif } @@ -1261,20 +1281,8 @@ void do_suspend_void(void) /* Handler for SIGCONT (continue after suspend). */ RETSIGTYPE do_continue(int signal) { -#ifdef ENABLE_MOUSE - if (ISSET(USE_MOUSE)) - enable_mouse_support(); -#endif - -#ifndef NANO_TINY - /* Perhaps the user resized the window while we slept. So act as if, - * and restore the terminal to its previous state in the process. */ - regenerate_screen(); -#else - /* Restore the state of the terminal and redraw the whole screen. */ - terminal_init(); - total_refresh(); -#endif + statusbar(_("Got a signal...\n")); + beep(); } #ifndef NANO_TINY