From 84ff9ebb91b775b84567f02cc5e0e6428bdf7b3e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 2 Jun 2017 13:19:19 +0200 Subject: [PATCH] display: don't let a SIGCONT write anything to the screen The old praxis of calling total_refresh() upon a SIGCONT was confusing, because the screen would look as if nano had returned from suspension, but in fact the shell was still active. Instead of calling total_refresh(), put a no-op key into ncurses' buffer, so that, when nano actually does return out of suspension (through 'fg'), this key will be read and discarded, upon which nano will go sit and wait for the next key, just before which it calls doupdate(). The latter is all we need to get the entire screen restored. This also fixes https://savannah.gnu.org/bugs/?51131 for "tiny". --- src/nano.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/nano.c b/src/nano.c index 7398b372..c2626e1b 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1267,15 +1267,14 @@ RETSIGTYPE do_continue(int signal) #endif #ifndef NANO_TINY - /* Perhaps the user resized the window while we slept. So set that - * flag, and tickle the input routine so that it will see the flag. */ + /* Perhaps the user resized the window while we slept. */ the_window_resized = TRUE; - ungetch(KEY_F0); #else - /* Restore the state of the terminal and redraw the whole screen. */ + /* Restore the state of the terminal. */ terminal_init(); - total_refresh(); #endif + /* Tickle the input routine so it will update the screen. */ + ungetch(KEY_F0); } #ifndef NANO_TINY