code: def is_cursor_on_last_line(self):
          
          cursor = self.textCursor()
          cursor.movePosition(QTextCursor.EndOfBlock)
          return cursor.atEnd()
docs: Return True if cursor is on the last line