From 23b74b226e2d5ef4a7c9c19f15471d0a8af31e58 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Mon, 21 Jan 2002 20:32:22 +0000
Subject: [PATCH] - nano.c:do_int_spell_fix() - Temporarily unset
 REVERSE_SEARCH if it's set (Rocco Corsi)

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

diff --git a/ChangeLog b/ChangeLog
index b7e29900..7b871473 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,8 @@ CVS code -
   do_char()
 	- Run edit_refresh() if ENABLE_COLOR is defined so adding
 	  multi-liners will update (e.g. /* in C).
+  do_int_spell_fix()
+	- Temporarily unset REVERSE_SEARCH if it's set (Rocco Corsi).
   do_suspend()
 	- Call tcsetattr() to restore the old terminal settings, so
 	  tcsh can use ^C after suspend for example (fixes BUG #68).
diff --git a/nano.c b/nano.c
index 37fa6a52..b6eaf90c 100644
--- a/nano.c
+++ b/nano.c
@@ -1448,12 +1448,16 @@ int do_int_spell_fix(char *word)
 {
     char *prevanswer = NULL, *save_search = NULL, *save_replace = NULL;
     filestruct *begin;
-    int i = 0, j = 0, beginx, beginx_top;
+    int i = 0, j = 0, beginx, beginx_top, reverse_search_set;
 
     /* save where we are */
     begin = current;
     beginx = current_x + 1;
 
+    /* Make sure Spell Check goes forward only */
+    reverse_search_set = ISSET(REVERSE_SEARCH);
+    UNSET(REVERSE_SEARCH);
+
     /* save the current search/replace strings */
     search_init_globals();
     save_search = mallocstrcpy(save_search, last_search);
@@ -1512,6 +1516,10 @@ int do_int_spell_fix(char *word)
     current = begin;
     current_x = beginx - 1;
 
+    /* restore Search/Replace direction */
+    if (reverse_search_set)
+	SET(REVERSE_SEARCH);
+
     edit_update(current, CENTER);
 
     if (i == -1)
-- 
GitLab