From 1d8fa1fa9029110547dde4c3a61d12db714c16b0 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Tue, 10 Dec 2002 00:53:21 +0000
Subject: [PATCH] Make speller update the screen less excessively, and switch
 case sensitive search so we can fix individual capitalization cases of
 misspelled words

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1326 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 nano.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/nano.c b/nano.c
index 22c813b8..13f9064d 100644
--- a/nano.c
+++ b/nano.c
@@ -1584,7 +1584,7 @@ int do_int_spell_fix(const char *word)
     char *save_search;
     char *save_replace;
     filestruct *begin;
-    int i = 0, j = 0, beginx, beginx_top, reverse_search_set;
+    int i = 0, j = 0, beginx, beginx_top, reverse_search_set, case_sens_set;
 #ifndef NANO_SMALL
     int mark_set;
 #endif
@@ -1597,6 +1597,9 @@ int do_int_spell_fix(const char *word)
     reverse_search_set = ISSET(REVERSE_SEARCH);
     UNSET(REVERSE_SEARCH);
 
+    case_sens_set = ISSET(CASE_SENSITIVE);
+    SET(CASE_SENSITIVE);
+
 #ifndef NANO_SMALL
     /* Make sure the marking highlight is off during Spell Check */
     mark_set = ISSET(MARK_ISSET);
@@ -1618,8 +1621,6 @@ int do_int_spell_fix(const char *word)
 
     search_last_line = FALSE;
 
-    edit_update(fileage, TOP);
-
     while (1) {
 	/* make sure word is still mis-spelt (i.e. when multi-errors) */
 	if (findnextstr(TRUE, FALSE, fileage, beginx_top, word) != NULL) {
@@ -1628,6 +1629,7 @@ int do_int_spell_fix(const char *word)
 	    if (!is_whole_word(current_x, current->data, word))
 		continue;
 
+	    edit_refresh();
 	    do_replace_highlight(TRUE, word);
 
 	    /* allow replace word to be corrected */
@@ -1661,14 +1663,15 @@ int do_int_spell_fix(const char *word)
     if (reverse_search_set)
 	SET(REVERSE_SEARCH);
 
+    if (!case_sens_set)
+	UNSET(CASE_SENSITIVE);
+
 #ifndef NANO_SMALL
     /* restore marking highlight */
     if (mark_set)
 	SET(MARK_ISSET);
 #endif
 
-    edit_update(current, CENTER);
-
     if (i == -1)
 	return FALSE;
 
-- 
GitLab