From 3f695b8fb7b04dcc7634320f61f5a242fee702ff Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 30 Mar 2019 19:23:15 +0100 Subject: [PATCH] speller: resizing can happen also when configured with --enable-tiny When nano was configured with --enable-tiny --enable-speller, the block_sigwinch() function should be available, to mask SIGWINCHes during a spell check. --- src/nano.c | 22 ++++++++++++---------- src/proto.h | 4 +++- src/text.c | 4 ---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/nano.c b/src/nano.c index 47a7fe0e..12ca54c3 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1300,6 +1300,18 @@ RETSIGTYPE do_continue(int signal) ungetch(KEY_FLUSH); } +#ifdef ENABLE_SPELLER +/* Block or unblock the SIGWINCH signal, depending on the blockit parameter. */ +void block_sigwinch(bool blockit) +{ + sigset_t winch; + + sigemptyset(&winch); + sigaddset(&winch, SIGWINCH); + sigprocmask(blockit ? SIG_BLOCK : SIG_UNBLOCK, &winch, NULL); +} +#endif + #ifndef NANO_TINY /* Handler for SIGWINCH (window size change). */ RETSIGTYPE handle_sigwinch(int signal) @@ -1362,16 +1374,6 @@ void regenerate_screen(void) total_refresh(); } -/* Block or unblock the SIGWINCH signal, depending on the blockit parameter. */ -void block_sigwinch(bool blockit) -{ - sigset_t winch; - - sigemptyset(&winch); - sigaddset(&winch, SIGWINCH); - sigprocmask(blockit ? SIG_BLOCK : SIG_UNBLOCK, &winch, NULL); -} - /* Handle the global toggle specified in flag. */ void do_toggle(int flag) { diff --git a/src/proto.h b/src/proto.h index 9283b86c..49e6f6a8 100644 --- a/src/proto.h +++ b/src/proto.h @@ -424,10 +424,12 @@ RETSIGTYPE handle_crash(int signal); #endif RETSIGTYPE do_suspend(int signal); RETSIGTYPE do_continue(int signal); +#ifdef ENABLE_SPELLER +void block_sigwinch(bool blockit); +#endif #ifndef NANO_TINY RETSIGTYPE handle_sigwinch(int signal); void regenerate_screen(void); -void block_sigwinch(bool blockit); void do_toggle(int flag); void enable_signals(void); #endif diff --git a/src/text.c b/src/text.c index ba532c04..3a967b70 100644 --- a/src/text.c +++ b/src/text.c @@ -2654,15 +2654,11 @@ const char *do_alt_speller(char *tempfile_name) } else if (pid_spell < 0) return _("Could not fork"); -#ifndef NANO_TINY /* Block SIGWINCHes while waiting for the alternate spell checker's end, * so nano doesn't get pushed past the wait(). */ block_sigwinch(TRUE); -#endif wait(&alt_spell_status); -#ifndef NANO_TINY block_sigwinch(FALSE); -#endif /* Reenter curses mode. */ doupdate();