        def _scroll(self, lines):
            """
            Scroll the window up or down.

            :param lines: Number of lines to scroll.  Negative numbers scroll
                down.
            """
            if lines < 0:
                start = curses.tparm(self._move_y_x, 0, 0).decode("utf-8")
                scroll = (self._up_line + self._clear_line) * -lines
            else:
                start = curses.tparm(self._move_y_x, self.height, 0).decode("utf-8")
                scroll = (self._down_line + self._clear_line) * lines
            self._safe_write(f"{start}{scroll}")
Scroll the window up or down.

:param lines: Number of lines to scroll.  Negative numbers scroll
down.
asciimatics/screen.py