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

        :param lines: Number of lines to scroll.  Negative numbers move the buffer up.
        """
        line = [(" ", Screen.COLOUR_WHITE, 0, 0, 1) for _ in range(self._width)]
        if lines > 0:
            # Limit to buffer size - this will just invalidate all the data
            lines = min(lines, self._height)
            for y in range(0, self._height - lines):
                self._double_buffer[y] = self._double_buffer[y + lines]
                self._screen_buffer[y] = self._screen_buffer[y + lines]
            for y in range(self._height - lines, self._height):
                self._double_buffer[y] = line[:]
                self._screen_buffer[y] = line[:]
        else:
            # Limit to buffer size - this will just invalidate all the data
            lines = max(lines, -self._height)
            for y in range(self._height - 1, -lines - 1, -1):
                self._double_buffer[y] = self._double_buffer[y + lines]
                self._screen_buffer[y] = self._screen_buffer[y + lines]
            for y in range(0, -lines):
                self._double_buffer[y] = line[:]
                self._screen_buffer[y] = line[:]
Scroll the window up or down.

:param lines: Number of lines to scroll.  Negative numbers move the buffer up.
asciimatics/screen.py