diff --git a/ChangeLog b/ChangeLog
index 3e4667dea0044925208c36b2f3c6663d51ac2786..e5f8a46776db8c9b5c956433530ea58d32b0586e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -155,6 +155,9 @@ CVS code -
 	  the spell checker will sometimes only correct the misspelled
 	  word instances that appear before the cursor position and then
 	  stop. (Rocco)
+	- Use do_replace_loop()'s canceled parameter in order to ensure
+	  that the spell checking stops if we canceled at the replace
+	  prompt. (DLR)
   do_alt_speller()
 	- Call terminal_init() unconditionally after running the
 	  alternate spell checker, so that the terminal state is
@@ -221,6 +224,8 @@ CVS code -
 	  replacing only marked text when the mark is on. (DLR,
 	  suggested by Joseph Birthisel)
 	- Return ssize_t instead of int. (DLR)
+	- Add new parameter canceled, set to TRUE if we canceled at the
+	  prompt and FALSE otherwise. (DLR)
 - utils.c:
   regexp_bol_or_eol()
 	- Don't assume any longer that string will be found if
diff --git a/src/nano.c b/src/nano.c
index c38d59e44501186104e0533f64171c7bc48bf7f0..3fb17faa4297b3aeed7c0c08a3f20abfa62cdd0e 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1424,7 +1424,7 @@ bool do_int_spell_fix(const char *word)
     filestruct *edittop_save = edittop;
     filestruct *current_save = current;
 	/* Save where we are. */
-    bool accepted = TRUE;
+    bool canceled = FALSE;
 	/* The return value. */
     bool case_sens_set = ISSET(CASE_SENSITIVE);
 #ifndef NANO_SMALL
@@ -1477,17 +1477,18 @@ bool do_int_spell_fix(const char *word)
 	    do_replace_highlight(TRUE, word);
 
 	    /* Allow all instances of the word to be corrected. */
-	    accepted = (statusq(FALSE, spell_list, word,
+	    canceled = (statusq(FALSE, spell_list, word,
 #ifndef NANO_SMALL
 			NULL,
 #endif
-			 _("Edit a replacement")) != -1);
+			 _("Edit a replacement")) == -1);
 
 	    do_replace_highlight(FALSE, word);
 
-	    if (accepted && strcmp(word, answer) != 0) {
+	    if (!canceled && strcmp(word, answer) != 0) {
 		current_x--;
-		do_replace_loop(word, current, &current_x, TRUE);
+		do_replace_loop(word, current, &current_x, TRUE,
+			&canceled);
 	    }
 
 	    break;
@@ -1526,7 +1527,7 @@ bool do_int_spell_fix(const char *word)
 	SET(MARK_ISSET);
 #endif
 
-    return accepted;
+    return !canceled;
 }
 
 /* Integrated spell checking using 'spell' program.  Return value: NULL
diff --git a/src/proto.h b/src/proto.h
index 0726ca0b7bf59b7a00e8305a0f87627aa30cf5d0..3f2a1d8723885120d63bfbb0a7cd01dfd2d91ade 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -416,7 +416,7 @@ int replace_regexp(char *string, bool create_flag);
 #endif
 char *replace_line(const char *needle);
 ssize_t do_replace_loop(const char *needle, filestruct *real_current,
-	size_t *real_current_x, bool wholewords);
+	size_t *real_current_x, bool wholewords, bool *canceled);
 void do_replace(void);
 void do_gotoline(int line, bool save_pos);
 void do_gotoline_void(void);
diff --git a/src/search.c b/src/search.c
index 43ef06e37ec307bb4371ab854d977dbc77947c6f..1abf9386730c1158ea5fbed875959840528aa7af 100644
--- a/src/search.c
+++ b/src/search.c
@@ -652,9 +652,10 @@ char *replace_line(const char *needle)
  * is replaced by a shorter word.
  *
  * needle is the string to seek.  We replace it with answer.  Return -1
- * if needle isn't found, else the number of replacements performed. */
+ * if needle isn't found, else the number of replacements performed.  If
+ * canceled isn't NULL, set it to TRUE if we canceled. */
 ssize_t do_replace_loop(const char *needle, filestruct *real_current,
-	size_t *real_current_x, bool wholewords)
+	size_t *real_current_x, bool wholewords, bool *canceled)
 {
     ssize_t numreplaced = -1;
     size_t match_len;
@@ -687,6 +688,9 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
     }
 #endif
 
+    if (canceled != NULL)
+	*canceled = FALSE;
+
     while (findnextstr(TRUE, wholewords,
 #ifdef HAVE_REGEX_H
 	/* We should find a bol and/or eol regex only once per line.  If
@@ -772,8 +776,11 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
 	    free(exp_word);
 	    curs_set(1);
 
-	    if (i == -1)	/* We canceled the replace. */
+	    if (i == -1) {	/* We canceled the replace. */
+		if (canceled != NULL)
+		    *canceled = TRUE;
 		break;
+	    }
 	}
 
 #ifdef HAVE_REGEX_H
@@ -937,7 +944,8 @@ void do_replace(void)
     beginx = current_x;
     pww_save = placewewant;
 
-    numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE);
+    numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE,
+	NULL);
 
     /* Restore where we were. */
     edittop = edittop_save;