def cursorAtSpaceEnd(block):
            cursor = QTextCursor(block)
            cursor.setPosition(block.position() + len(blockIndentation(block)))
            return cursor
def reorder_item(self, item, position):
    new_position = min(max(position, 0), len(self._items) - 1)