'Set the current cursor position to whatever cursor is on top
of the stack.'

def restore_cursor(self):

    if self.savepoints:
        savepoint = self.savepoints.pop()
        self.g0_charset = savepoint.g0_charset
        self.g1_charset = savepoint.g1_charset
        self.charset = savepoint.charset
        if savepoint.origin:
            self.set_mode(mo.DECOM)
        if savepoint.wrap:
            self.set_mode(mo.DECAWM)
        self.cursor = savepoint.cursor
        self.ensure_bounds(use_margins=True)
    else:
        self.reset_mode(mo.DECOM)
        self.cursor_position()
