speller: avoid messing up the screen when an unknown locale is used

When invoking the "internal" speller, leave curses mode while the three
programs in the pipe array are executing, to prevent 'hunspell' from
writing a long error message to the end of the status bar, making the
screen scroll, and thus messing it up.  Now the error message gets
printed to the screen that nano was started up from, and will thus be
visible when the user exits from nano.  (At least: it will be so on a
terminal emulator -- on a VT, nothing will be seen.)

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

Bug existed since version 4.6, commit 4d77e0ad.
master
Benno Schulenberg 2020-02-03 13:50:33 +01:00
parent 06c80b6ccd
commit 6119756347
1 changed files with 7 additions and 0 deletions

View File

@ -2446,6 +2446,9 @@ const char *do_int_speller(const char *tempfile_name)
return _("Could not get size of pipe buffer");
}
/* Leave curses mode so that error messages go to the original screen. */
endwin();
/* Block SIGWINCHes while reading misspelled words from the third pipe. */
block_sigwinch(TRUE);
@ -2466,6 +2469,10 @@ const char *do_int_speller(const char *tempfile_name)
block_sigwinch(FALSE);
/* Re-enter curses mode. */
terminal_init();
doupdate();
/* Do any replacements case-sensitively, forward, and without regexes. */
SET(CASE_SENSITIVE);
UNSET(BACKWARDS_SEARCH);