commit 8eccc7198b45b63e990c56809015140f4380f272
Author:     Jochen Sprickerhof <[email protected]>
AuthorDate: Sat Apr 18 23:05:09 2020 +0200
Commit:     Jochen Sprickerhof <[email protected]>
CommitDate: Sat Apr 18 23:05:09 2020 +0200

    Fix redraw if cursor is not at the bottom

diff --git a/scroll.c b/scroll.c
index 09a2c3e..d1e28c0 100644
--- a/scroll.c
+++ b/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

Reply via email to