From 439fbe3e938ba5d40b850495542d383717cb4b70 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sat, 16 Oct 2004 04:56:34 +0000
Subject: [PATCH] in do_alt_speller(), call terminal_init() unconditionally
 after running the alternate spell checker, so that the terminal state is
 properly restored in all cases

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1994 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog  | 4 ++++
 src/nano.c | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 3318e0e2..e34ad828 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -130,6 +130,10 @@ CVS code -
 	  NANO_SMALL is defined and DISABLE_SPELLER isn't.  Also, turn
 	  the USE_REGEXP flag off during spell checking in order to
 	  avoid a potential segfault. (DLR)
+  do_alt_speller()
+	- Call terminal_init() unconditionally after running the
+	  alternate spell checker, so that the terminal state is
+	  properly restored in all cases. (DLR)
   justify_format()
 	- For more compatibility with Pico, remove extra space after a
 	  character in punct if that character is the same as the one
diff --git a/src/nano.c b/src/nano.c
index 5c6ad0f7..8c618b2f 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1782,6 +1782,9 @@ const char *do_alt_speller(char *tempfile_name)
 
     refresh();
 
+    /* Restore the terminal to its previous state. */
+    terminal_init();
+
 #ifndef NANO_SMALL
     if (old_mark_set) {
 	do_gotopos(mbb_lineno_cur, mark_beginx, y_cur, 0);
@@ -1793,7 +1796,6 @@ const char *do_alt_speller(char *tempfile_name)
 #endif
 	/* Only reload the temp file if it isn't a marked selection. */
 	free_filestruct(fileage);
-	terminal_init();
 	global_init(TRUE);
 
 	/* Do what load_buffer() would do, except for making a new
-- 
GitLab