"TeL vddlmZddlZddlmZddlmZddlmZm Z ejdZ ddZ ddd Z ed k(r{dd lmZed Zej#dee dd ed Zej%ej#dej%ej#dyy)) annotationsN)Iterable) loop_last)cell_len chop_cellsz \s*\S+\s*c#Kd}tj||}|E|j\}}|jd}|||ftj||}|Dyyw)zYields 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. rN)re_wordmatchspangroup)textposition word_matchstartendwords ,/usr/lib/python3/dist-packages/rich/_wrap.pywordsr sh HtX.J  __& s"S$]]4-  s AA#!A#cg}|j}d}t}t|D]\}}} || j} ||z } | | k\} | r ||| z }5| |kDrY|rDt | |} t | D](\}}|r|||r ||}|t |z }*|r|||| }|s|s|||| }|S)aGiven 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. rwidth)appendrrrstriprrlen)rrfoldbreak_positionsr cell_offset _cell_lenr_endr word_lengthremaining_spaceword_fits_remaining_space folded_wordlastlines r divide_liner's"$O  # #FKI"4[ .tT . +-$3{$B! $ 9T? *KU"",T"?K&/ &</ d "5M*3D/K!SY.E /u "+D/Ku 'o A .D __main__)Console rz@12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345abcdefghijklmnopqrstuvwxyzuRTextualはPythonの高速アプリケーション開発フレームワークですu4アプリケーションは1670万色を使用でき)rstrreturnzIterable[tuple[int, int, str]])T)rr.rintrboolr/z list[int]) __future__rretypingr_looprcellsrrcompiler rr'__name__consoler*printruler(rr=s" ' "**\ " .4n z BG MMTU *12 67BG LLN MMfg LLN MMHIr(