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.
master
Benno Schulenberg 2019-03-30 19:23:15 +01:00
parent 55699dc171
commit 3f695b8fb7
3 changed files with 15 additions and 15 deletions

View File

@ -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)
{

View File

@ -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

View File

@ -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();