diff --git a/src/files.c b/src/files.c
index cfe43ab3ae8e00e7c9a1b93a0e55039e6a84b711..c57c4363432b0dafd780931d539c2e02f2ec8dc8 100644
--- a/src/files.c
+++ b/src/files.c
@@ -130,6 +130,7 @@ void initialize_buffer_text(void)
     openfile->edittop = openfile->fileage;
     openfile->current = openfile->fileage;
 
+    openfile->firstcolumn = 0;
     openfile->current_x = 0;
     openfile->totsize = 0;
 }
@@ -627,6 +628,14 @@ void switch_to_prevnext_buffer(bool to_next)
     fprintf(stderr, "filename is %s\n", openfile->filename);
 #endif
 
+#ifndef NANO_TINY
+    /* When not in softwrap mode, make sure firstcolumn is zero.  It might
+     * be nonzero if we had softwrap mode on while in this buffer, and then
+     * turned softwrap mode off while in a different buffer. */
+    if (!ISSET(SOFTWRAP))
+	openfile->firstcolumn = 0;
+#endif
+
     /* Update the screen to account for the current buffer. */
     display_buffer();
 
diff --git a/src/nano.c b/src/nano.c
index 2155d8ea622fa6fa9737e79658af31ea3a405482..8bf3ca8065b11bee0b7269b2258f85a892ffb1e1 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1398,12 +1398,16 @@ void do_toggle(int flag)
 	case SUSPEND:
 	    signal_init();
 	    break;
+	case SOFTWRAP:
+	    if (!ISSET(SOFTWRAP))
+		openfile->firstcolumn = 0;
+	    refresh_needed = TRUE;
+	    break;
 	case WHITESPACE_DISPLAY:
 	    titlebar(NULL);	/* Fall through. */
 #ifndef DISABLE_COLOR
 	case NO_COLOR_SYNTAX:
 #endif
-	case SOFTWRAP:
 	    refresh_needed = TRUE;
 	    break;
     }
diff --git a/src/nano.h b/src/nano.h
index 60fc8c6b96d42f2e8182b26cda00f217630fb229..478fbd8cfff8ea35a998e818dc9eaa924a4ff440 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -353,6 +353,9 @@ typedef struct openfilestruct {
 	/* The current line for this file. */
     size_t totsize;
 	/* The file's total number of characters. */
+    size_t firstcolumn;
+	/* The starting column of the top line of the edit window.
+	 * When not in softwrap mode, it's always zero. */
     size_t current_x;
 	/* The file's x-coordinate position. */
     size_t placewewant;