code: def go_to_previous_cell(self):
          
          cursor = self.textCursor()
          cur_pos = prev_pos = cursor.position()
  
          if self.is_cell_separator(cursor):
              # Move to the previous cell
              cursor.movePosition(QTextCursor.PreviousBlock)
              cur_pos = prev_pos = cursor.position()
  
          while not self.is_cell_separator(cursor):
              # Move to the previous cell or the beginning of the current cell
              cursor.movePosition(QTextCursor.PreviousBlock)
              prev_pos = cur_pos
              cur_pos = cursor.position()
              if cur_pos == prev_pos:
                  return
  
          self.setTextCursor(cursor)
docs: Go to the previous cell of lines