'Moves the screen page up through the history buffer. Page
size is defined by ``history.ratio``, so for instance
``ratio = .5`` means that half the screen is restored from
history on page switch.'

def prev_page(self):

    if ((self.history.position > self.lines) and self.history.top):
        mid = min(len(self.history.top), int(math.ceil((self.lines * self.history.ratio))))
        self.history.bottom.extendleft(reversed(self.buffer[(- mid):]))
        self.history = self.history._replace(position=(self.history.position - self.lines))
        self.buffer[:] = (list(reversed([self.history.top.pop() for _ in range(mid)])) + self.buffer[:(- mid)])
        self.dirty = set(range(self.lines))
