From 611975634755e09d67d5217e079335f03ec7906e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 3 Feb 2020 13:50:33 +0100 Subject: [PATCH] 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. --- src/text.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/text.c b/src/text.c index e7d5cee9..039d1161 100644 --- a/src/text.c +++ b/src/text.c @@ -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);