code: def move(self, direction, n_windows):
          
  
          assert direction in (-1, 1)
  
          valid, redraw = True, False
          forward = ((direction * self.step) > 0)
  
          if forward:
              if self.page_index < 0:
                  if self._is_valid(0):
                      # Special case - advance the page index if less than zero
                      self.page_index = 0
                      self.cursor_index = 0
                      redraw = True
                  else:
                      valid = False
              else:
                  self.cursor_index += 1
                  if not self._is_valid(self.absolute_index):
                      # Move would take us out of bounds
                      self.cursor_index -= 1
                      valid = False
                  elif self.cursor_index >= (n_windows - 1):
                      # Flip the orientation and reset the cursor
                      self.flip(self.cursor_index)
                      self.cursor_index = 0
                      self.top_item_height = None
                      redraw = True
          else:
              if self.cursor_index > 0:
                  self.cursor_index -= 1
                  if self.top_item_height and self.cursor_index == 0:
                      # Selecting the partially displayed item
                      self.top_item_height = None
                      redraw = True
              else:
                  self.page_index -= self.step
                  if self._is_valid(self.absolute_index):
                      # We have reached the beginning of the page - move the
                      # index
                      self.top_item_height = None
                      redraw = True
                  else:
                      self.page_index += self.step
                      valid = False  # Revert
  
          return valid, redraw
docs: Move the cursor up or down by the given increment.
  
          Params:
              direction (int): `1` will move the cursor down one item and `-1`
                  will move the cursor up one item.
              n_windows (int): The number of items that are currently being drawn
                  on the screen.
  
          Returns:
              valid (bool): Indicates whether or not the attempted cursor move is
                  allowed. E.g. When the cursor is on the last comment,
                  attempting to scroll down any further would not be valid.
              redraw (bool): Indicates whether or not the screen needs to be
                  redrawn.