nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit a969adf804af130b44c0d8d12def5fb915b1c868
parent 59b0f81bfa2dae868e1d057860d88a56db1dfbe2
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Wed, 31 May 2017 14:44:42 +0200

suspension: fake a SIGWINCH when coming back out of the background

When receiving a SIGCONT, don't call regenerate_screen() directly
but act as if a SIGWINCH occurred.  Also insert a dummy key, and
thus let the relevant input routine redraw the relevant subwindows.

Use KEY_F0 as the dummy key, as both Ncurses and Slang know it, and
it should normally do nothing at all.

This fixes https://savannah.gnu.org/bugs/?51124.

Diffstat:
Msrc/nano.c | 7++++---
Msrc/winio.c | 3++-
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -1267,9 +1267,10 @@ RETSIGTYPE do_continue(int signal) #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(); + /* 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. */ + the_window_resized = TRUE; + ungetch(KEY_F0); #else /* Restore the state of the terminal and redraw the whole screen. */ terminal_init(); diff --git a/src/winio.c b/src/winio.c @@ -701,8 +701,9 @@ int parse_kbinput(WINDOW *win) #ifdef KEY_RESIZE /* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */ case KEY_RESIZE: - return ERR; #endif + case KEY_F0: + return ERR; } return retval;