Centers the text cursor position.

    :param object: Object to decorate.
    :type object: object
    :return: Object.
    :rtype: object

def center_text_cursor(object):
    """
    Centers the text cursor position.

    :param object: Object to decorate.
    :type object: object
    :return: Object.
    :rtype: object
    """

    @functools.wraps(object)
    def center_text_cursor_wrapper(*args, **kwargs):
        """
        Centers the text cursor position.

        :param \*args: Arguments.
        :type \*args: \*
        :param \*\*kwargs: Keywords arguments.
        :type \*\*kwargs: \*\*
        :return: Object.
        :rtype: object
        """

        if args:
            if hasattr(foundations.common.get_first_item(args), "setCenterOnScroll"):
                foundations.common.get_first_item(args).setCenterOnScroll(True)

        value = object(*args, **kwargs)

        if args:
            if hasattr(foundations.common.get_first_item(args), "setCenterOnScroll"):
                foundations.common.get_first_item(args).setCenterOnScroll(False)

        return value

    return center_text_cursor_wrapper