%PDF- %PDF-
Direktori : /lib/python3/dist-packages/rich/__pycache__/ |
Current File : //lib/python3/dist-packages/rich/__pycache__/_wrap.cpython-312.pyc |
� "T�eL � �v � d dl mZ d dlZd dlmZ ddlmZ ddlmZm Z ej d� Zdd�Zddd �Z ed k( r{ddlmZ ed� � Zej# d� e e dd� � ed� � Zej% � ej# d� ej% � ej# d� yy)� )�annotationsN)�Iterable� )� loop_last)�cell_len� chop_cellsz \s*\S+\s*c # �� K � d}t j | |� }|�E|j � \ }}|j d� }|||f�� t j | |� }|��Dyy�w)z�Yields each word from the text as a tuple containing (start_index, end_index, word). A "word" in this context may include the actual word and any whitespace to the right. r N)�re_word�match�span�group)�text�position� word_match�start�end�words �,/usr/lib/python3/dist-packages/rich/_wrap.py�wordsr sh � �� � �H����t�X�.�J� � ��_�_�&� ��s�����"���S�$����]�]�4��-� � � �s �AA#�!A#c � � g }|j }d}t }t | � D ]� \ }}} || j � � } ||z }|| k\ }|r| || � z }�5| |kD rY|rDt | |�� } t | � D ]( \ }}|r ||� |r ||� }�|t |� z }�* ��|r ||� || � }��|s��|s�� ||� || � }�� |S )a� Given a string of text, and a width (measured in cells), return a list of cell offsets which the string should be split at in order for it to fit within the given width. Args: text: The text to examine. width: The available cell width. fold: If True, words longer than `width` will be folded onto a new line. Returns: A list of indices to break the line at. r ��width)�appendr r �rstripr r �len)r r �fold�break_positionsr �cell_offset� _cell_lenr �_endr �word_length�remaining_space�word_fits_remaining_space�folded_word�last�lines r �divide_liner'