diff --git a/ChangeLog b/ChangeLog
index 09c5cb822d3f7ecb5b1a591ca109128ac0d47c3d..75128b5661404c69620caecec39570ec4556d3b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 CVS code -
+- General:
+	- Make sure that the statusbar cursor position is always
+	  properly reset when we get out of all statusbar prompts.
+	  Changes to do_insertfile(), do_writeout(),
+	  handle_sigwinch(), main(), and do_prompt_abort(). (DLR)
 
 GNU nano 1.9.99pre1 - 2006.08.29
 - General:
diff --git a/src/files.c b/src/files.c
index a9190e79e83599c5dadc44feed074f93aa62d092..09f9fb59a3bd8ba2cd5f08623cdc319b4685b4c6 100644
--- a/src/files.c
+++ b/src/files.c
@@ -766,13 +766,11 @@ void do_insertfile(
 		if (tmp == NULL)
 		    continue;
 
+		/* We have a file now.  Indicate this. */
 		free(answer);
 		answer = tmp;
 
-		/* We have a file now.  Indicate this and get out of the
-		 * statusbar prompt cleanly. */
 		i = 0;
-		do_prompt_abort();
 	    }
 #endif
 
@@ -1825,12 +1823,9 @@ int do_writeout(bool exiting)
 		if (tmp == NULL)
 		    continue;
 
+		/* We have a file now.  Indicate this. */
 		free(answer);
 		answer = tmp;
-
-		/* We have a file now.  Get out of the statusbar prompt
-		 * cleanly. */
-		do_prompt_abort();
 	    } else
 #endif /* !DISABLE_BROWSER */
 #ifndef NANO_TINY
diff --git a/src/nano.c b/src/nano.c
index 7ce83123128604f80d6943b2c6bb91d36ec61b8f..e2a13365a99758e9454b499c4b2b8c77a280db37 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1088,10 +1088,6 @@ RETSIGTYPE handle_sigwinch(int signal)
     COLS = win.ws_col;
     LINES = win.ws_row;
 
-    /* Just in case we're in the statusbar prompt, reset the statusbar
-     * cursor position. */
-     do_prompt_abort();
-
     /* If we've partitioned the filestruct, unpartition it now. */
     if (filepart != NULL)
 	unpartition_filestruct(&filepart);
@@ -2252,6 +2248,10 @@ int main(int argc, char **argv)
 	/* Read in and interpret characters. */
 	do_input(&meta_key, &func_key, &s_or_t, &ran_func, &finished,
 		TRUE);
+
+	 /* Just in case we were in the statusbar prompt, reset the
+	  * statusbar cursor position. */
+	 do_prompt_abort();
     }
 
     /* We should never get here. */
diff --git a/src/prompt.c b/src/prompt.c
index 626ca2524d53f2056dc2885390a8a9c80a608c46..bccc5d169aa92c997ba43dc5cfd8ca0d990b8ee7 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -1247,10 +1247,13 @@ int do_prompt(bool allow_tabs,
 }
 
 /* This function forces a reset of the statusbar cursor position.  It
- * should only be called after do_prompt(), and is only needed if we
- * leave the prompt via something other than Cancel or Enter. */
+ * should be called when we get out of all statusbar prompts. */
 void do_prompt_abort(void)
 {
+    /* Uninitialize the old cursor position in answer. */
+    old_statusbar_x = (size_t)-1;
+    old_pww = (size_t)-1;
+
     reset_statusbar_x = TRUE;
 }