diff --git a/src/winio.c b/src/winio.c
index b2abd456e593beb91ef25b23ab64c41ee3afa422..eccf41c1ab2935baa814767afd279d7c1bb90a05 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2970,8 +2970,13 @@ void edit_update(update_type manner)
     if (manner == CENTERING)
 	goal = editwinrows / 2;
     else if (manner == FLOWING) {
-	if (openfile->current->lineno >= openfile->edittop->lineno)
+	if (openfile->current->lineno >= openfile->edittop->lineno) {
 	    goal = editwinrows - 1;
+#ifndef NANO_TINY
+	    if (ISSET(SOFTWRAP))
+		goal -= strlenpt(openfile->current->data) / COLS ;
+#endif
+	}
     } else {
 	goal = openfile->current_y;
 
@@ -2986,8 +2991,11 @@ void edit_update(update_type manner)
 	openfile->edittop = openfile->edittop->prev;
 	goal --;
 #ifndef NANO_TINY
-	if (ISSET(SOFTWRAP))
+	if (ISSET(SOFTWRAP)) {
 	    goal -= strlenpt(openfile->edittop->data) / COLS;
+	    if (goal < 0)
+		openfile->edittop = openfile->edittop->next;
+	}
 #endif
     }
 #ifdef DEBUG