code: def is_cursor_on_first_line(self):
          
          cursor = self.textCursor()
          cursor.movePosition(QTextCursor.StartOfBlock)
          return cursor.atStart()
docs: Return True if cursor is on the first line