code: def move_page(self, direction, n_windows):
          
  
          assert direction in (-1, 1)
          assert n_windows >= 0
  
          # top of subreddit/submission page or only one
          # submission/reply on the screen: act as normal move
          if (self.absolute_index < 0) | (n_windows == 0):
              valid, redraw = self.move(direction, n_windows)
          else:
              # first page
              if self.absolute_index < n_windows and direction < 0:
                  self.page_index = -1
                  self.cursor_index = 0
                  self.inverted = False
  
                  # not submission mode: starting index is 0
                  if not self._is_valid(self.absolute_index):
                      self.page_index = 0
                  valid = True
              else:
                  # flip to the direction of movement
                  if ((direction > 0) & (self.inverted is True)) \
                          | ((direction < 0) & (self.inverted is False)):
                      self.page_index += (self.step * (n_windows - 1))
                      self.inverted = not self.inverted
                      self.cursor_index \
                          = (n_windows - (direction < 0)) - self.cursor_index
  
                  valid = False
                  adj = 0
                  # check if reached the bottom
                  while not valid:
                      n_move = n_windows - adj
                      if n_move == 0:
                          break
  
                      self.page_index += n_move * direction
                      valid = self._is_valid(self.absolute_index)
                      if not valid:
                          self.page_index -= n_move * direction
                          adj += 1
  
              redraw = True
  
          return valid, redraw
docs: Move the page down (positive direction) or up (negative direction).
  
          Paging down:
              The post on the bottom of the page becomes the post at the top of
              the page and the cursor is moved to the top.
          Paging up:
              The post at the top of the page becomes the post at the bottom of
              the page and the cursor is moved to the bottom.