def cursor_pos(self, pos):
        """ Set the cursor position """
        if pos >= 0:
            self._cursor_index = max(0, min(len(self._value), pos))
        else:
            self._cursor_index = max(len(self._value) + pos + 1, 0)
        self._reset_cursor_tick()
        self._render_text()