code: def cursor_position(self, value):
          
          assert isinstance(value, int)
          assert value <= len(self.text)
  
          changed = self._set_cursor_position(value)
  
          if changed:
              self._cursor_position_changed()
docs: Setting cursor position.