From 4401862e12fd7aa63103fbc6c428bda0f15284c9 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Mon, 25 Jul 2005 23:40:12 +0000 Subject: [PATCH] fix resizing while the alternate spell checker is running git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2935 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/text.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8997f492..0d3828c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -173,6 +173,10 @@ CVS code - no longer needed, and make the error message more similar to what the internal spell checker returns under the same circumstances. (DLR) + - Set the SIGWINCH handler back to the default just before + running the alternate spell checker, so that the alternate + spell checker can handle them, and set it back afterwards. + (DLR) do_spell() - When displaying an error message from do_(int|alt)_speller(), don't display the error message corresponding to errno if diff --git a/src/text.c b/src/text.c index c5b03179..1f83bb1c 100644 --- a/src/text.c +++ b/src/text.c @@ -1846,6 +1846,8 @@ const char *do_alt_speller(char *tempfile_name) size_t totsize_save = openfile->totsize; /* Our saved value of totsize, used when we spell-check a marked * selection. */ + struct sigaction newaction, oldaction; + /* Original and temporary handlers for SIGWINCH. */ if (old_mark_set) { /* If the mark is on, save the number of the line it starts on, @@ -1872,6 +1874,13 @@ const char *do_alt_speller(char *tempfile_name) } spellargs[arglen - 2] = tempfile_name; + /* Save the original SIGWINCH handler, and set the SIGWINCH handler + * back to the default, so that the alternate spell checker can + * handle a SIGWINCH its own way. */ + sigaction(SIGWINCH, NULL, &newaction); + newaction.sa_handler = SIG_DFL; + sigaction(SIGWINCH, &newaction, &oldaction); + /* Start a new process for the alternate speller. */ if ((pid_spell = fork()) == 0) { /* Start alternate spell program; we are using PATH. */ @@ -1888,6 +1897,9 @@ const char *do_alt_speller(char *tempfile_name) /* Wait for alternate speller to complete. */ wait(&alt_spell_status); + /* Set the SIGWINCH handler back to the original. */ + sigaction(SIGWINCH, &oldaction, NULL); + refresh(); /* Restore the terminal to its previous state. */