grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a BjŒj='ã@sÎddlmZmZddlZddlmZmZmZmZe  d¡Z e  edƒ¡Z da gd¢a dd„Zdd „Zd d „Zd d „Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zed krÊeƒdS)!é)ÚdivisionÚprint_functionN)ÚbytesÚBÚord2Ú text_typez^[ -~]*$)&)é~é)éŸr)i¯r )iÆr)iÇr )i×r)iÝr )ior)i‚r )i‰r)iûr )i_é)i+r )iar)i± r )iê r)i(#r )i*#r )i +r )i>0r )i?0r )i–0r )iš0r)iµMr )iÿMr )i£×r )iÿør )ijúr )iþr )i#þr)ikþr )iÿþr )i`ÿr )iÜÿr )iæÿr )iÿ×r )iýÿr )iýÿr cCs6|dks|dkrdStD]\}}||kr|SqdS)z5Return the screen column width for unicode ordinal o.éérr )Úwidths)ÚoÚnumÚwid©rú8/usr/lib64/python3.9/site-packages/urwid/old_str_util.pyÚ get_widthPs   rc Cst|tƒsJ|ƒ‚t||ƒ}|d@s2||dfStdƒ|df}t|ƒ}||}|dkr^|S|d@dkr¶t||dƒ}|d@dkrŠ|S|d@d>|d @B}|dkrª|S||dfS|d krÂ|S|d @dk�rLt||dƒ}|d@dkrð|St||dƒ}|d@dk�r|S|d @d >|d @d>B|d @B}|dk�r@|S||d fS|dk�rZ|S|d@d k�rt||dƒ}|d@dk�rŠ|St||dƒ}|d@dk�r¬|St||dƒ}|d@dk�rÎ|S|d@d>|d @d >B|d @d>B|d @B}|dk�r|S||dfS|S)zH Return (ordinal at pos, next position) for UTF-8 encoded text. é€r ú?r éàéÀééé?ééðr é iééøééi)Ú isinstancerrÚordÚlen) ÚtextÚposÚb1ÚerrorÚltÚb2rZb3Zb4rrrÚ decode_oneZs^          ,  r,cCst||ƒ|dfS)z7 decode_one implementation for unicode strings r )r$)r&ÚirrrÚdecode_one_uniŽsr.cCszt|tƒsJ|ƒ‚tdƒ|df}|}|dkrvt||ƒd@dkr\t||ƒ\}}||dfS|d8}||dkr&|Sq&dS)z‹ Return (ordinal at pos, next position) for UTF-8 encoded text. pos is assumed to be on the trailing byte of a utf-8 sequence. rr rrrrN)r#rr$rr,)r&r'r)ÚprÚnextrrrÚdecode_one_right”s  r1cCs|dvs J‚|adS)N)Úutf8ZnarrowÚwide©Ú_byte_encoding)ÚencrrrÚset_byte_encoding¤s r7cCstS)Nr4rrrrÚget_byte_encoding©sr8c Csþ||ksJt||fƒƒ‚t|tƒo(tdk}t|tƒ }|s>|ržttg|}|}d}d} ||kr–|||ƒ\} } t| ƒ} | ||krˆ||fS| }|| 7}qV||fSt|ƒtks¶Jt|ƒƒ‚||}||krÒ|||fStdkròt|||ƒdkrò|d8}|||fS)a9 Calculate the closest position to the screen column pref_col in text where start_offs is the offset into text assumed to be screen column 0 and end_offs is the end of the range to search. text may be unicode or a byte string in the target _byte_encoding Returns (position, actual_col). r2rr r3r ) Úreprr#rr5r,r.rÚtypeÚwithin_double_byte) r&Ú start_offsÚend_offsZpref_colÚutfsÚunisÚdecoder-ÚscÚnrÚwrrrÚ calc_text_pos¬s0      rDc Cs¢||ksJt||fƒƒ‚t|tƒo(tdk}t|tƒ }|rDt |¡rR|ršt |¡sšttg|}|}d}d}||kr–|||ƒ\} }t | ƒ} |}|| 7}qj|S||S)am Return the screen column width of text between start_offs and end_offs. text may be unicode or a byte string in the target _byte_encoding Some characters are wide (take two columns) and others affect the previous character (take zero columns). Use the widths table above to calculate the screen column width of text[start_offs:end_offs] r2rr ) r9r#rr5Ú SAFE_ASCII_REÚmatchÚSAFE_ASCII_BYTES_REr,r.r) r&r<r=r>r?r@r-rArBrrCrrrÚ calc_widthÐs&  ÿÿ  rHcCsnt|tƒr"t||ƒ}t|ƒdkSt|tƒs0J‚tdkrRt||ƒ\}}t|ƒdkStdkrjt|||ƒdkSdS)zƒ Test if the character at offs within text is wide. text may be unicode or a byte string in the target _byte_encoding r r2r3r F)r#rr$rrr5r,r;)r&ZoffsrrBrrrÚ is_wide_charîs    rIcCsŠ||ks J‚t|tƒr|dSt|tƒs,J‚tdkr^|d}t||ƒd@dkrZ|d8}q<|Stdkr‚t|||dƒdkr‚|dS|dS)z? Return the position of the character before end_offs. r r2rrr3r ©r#rrr5rr;©r&r<r=rrrrÚmove_prev_charÿs     ÿÿrLcCsŽ||ks J‚t|tƒr|dSt|tƒs,J‚tdkrf|d}||krbt||ƒd@dkrb|d7}q<|Stdkr†t|||ƒdkr†|dS|dS)z@ Return the position of the character after start_offs. r r2rrr3r rJrKrrrÚmove_next_chars     ÿÿrMcCs²t|tƒsJ‚t||ƒ}|dkrf|dkrf||kr6dSt||dƒdkrbt|||dƒdkrbdSdS|dkrrdS|d}||kržt||ƒdkr”qž|d8}qz||d@r®dSdS)ajReturn whether pos is within a double-byte encoded character. text -- byte string in question line_start -- offset of beginning of line (< pos) pos -- offset in question Return values: 0 -- not within dbe char, or double_byte_encoding == False 1 -- pos is on the 1st half of a dbe char 2 -- pos is on the 2nd half of a dbe char é@érr é�r r)r#rrr;)r&Z line_startr'Úvr-rrrr;#s"      r;c Cs"ddl}g}d}|j ¡D]Ð}|dd…dkr0q| ¡}| dd¡\}}| dd¡\}}| dd¡d}d|vr~| d¡d}t|d ƒ}|d vr–d} n|d vr¤d } nd} |durÂ| d| f¡| }|| krØ|| f|d <q| || f¡| }qtdƒ|dd…D]} td| fƒ�qtdƒdS)Nrr ú#ú;z # ú Ú.z..é)Z COMBININGZMODIFIERz )ÚWÚFr éÿÿÿÿz widths = [z %r,ú])ÚsysÚstdinÚ readlinesÚstripÚsplitÚintÚappendÚprint) r[ÚoutÚlastÚlineÚhexÚrestrZword1rÚlrrrrÚprocess_east_asian_widthIs8 riÚ__main__)Z __future__rrÚreZ urwid.compatrrrrÚcompilerErGr5rrr,r.r1r7r8rDrHrIrLrMr;riÚ__name__rrrrÚs* + 4$&%