commit 611975634755e09d67d5217e079335f03ec7906e
parent 06c80b6ccdd65e9c8c12dc2c3c7223b17c5ac723
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 3 Feb 2020 13:50:33 +0100
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.
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git 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);