diff --git a/Lib/_pyrepl/unix_console.py b/Lib/_pyrepl/unix_console.py index 96379bc20f3357..f0a5d8aa5cbc61 100644 --- a/Lib/_pyrepl/unix_console.py +++ b/Lib/_pyrepl/unix_console.py @@ -256,7 +256,9 @@ def refresh(self, screen, c_xy): # we make sure the cursor is on the screen, and that we're # using all of the screen if we can - if cy < offset: + if len(screen) < height: + offset = 0 + elif cy < offset: offset = cy elif cy >= offset + height: offset = cy - height + 1