diff --git a/src/winio.c b/src/winio.c
index 194d716f10872b08b6952de459894a5268429abc..7509a2cc5773eb204599c47c45c4c62108fb72e0 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2504,9 +2504,10 @@ void edit_draw(filestruct *fileptr, const char *converted,
 				 1, &endmatch, 0) == REG_NOMATCH)
 		end_line = end_line->next;
 
-	    /* If no end was found, or it is too early, next step. */
+	    /* If there is no end, there is nothing to paint. */
 	    if (end_line == NULL)
-		goto step_two;
+		goto tail_of_loop;
+	    /* If the end is scrolled off to the left, next step. */
 	    if (end_line == fileptr && endmatch.rm_eo <= from_x) {
 		fileptr->multidata[varnish->id] = CBEGINBEFORE;
 		goto step_two;