diff --git a/src/winio.c b/src/winio.c
index 531ac552d6094e5af0beb79886d1820d04c4f2e8..cbe16d88c743b04fec95a1db7b2bd658cf3dd7d5 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2921,8 +2921,8 @@ void edit_scroll(scroll_dir direction, int nrows)
     while (i > 0 && line != NULL) {
 #ifndef NANO_TINY
 	/* If the first blank row is in the middle of a softwrapped line,
-	 * compensate for the earlier chunks of that line. */
-	if (ISSET(SOFTWRAP) && i == nrows)
+	 * compensate for the earlier onscreen chunks of that line. */
+	if (ISSET(SOFTWRAP) && i == nrows && line != openfile->edittop)
 	    i += strnlenpt(line->data, leftedge) / editwincols;
 #endif
 	i -= update_line(line, (line == openfile->current) ?