Bläddra i källkod

Fix redraw if cursor is not at the bottom

Jochen Sprickerhof 5 år sedan
förälder
incheckning
8eccc7198b
1 ändrade filer med 4 tillägg och 2 borttagningar
  1. 4 2
      scroll.c

+ 4 - 2
scroll.c

@@ -259,9 +259,9 @@ redraw()
 
 	getcursorposition(&x, &y);
 
-	/* wind back bottom pointer by one page */
+	/* wind back bottom pointer by shown history */
 	for (; bottom != NULL && TAILQ_NEXT(bottom, entries) != NULL &&
-	    rows < x - 1; rows++)
+	    rows < x - 2; rows++)
 		bottom = TAILQ_NEXT(bottom, entries);
 
 	if (rows == 0)
@@ -282,6 +282,8 @@ redraw()
 		bottom = TAILQ_PREV(bottom, tailhead, entries);
 		write(STDOUT_FILENO, bottom->buf, bottom->size);
 	}
+	/* add new line in front of the shell prompt */
+	write(STDOUT_FILENO, "\n", 1);
 }
 
 void