
    Cj                       S SK Jr  S SKrS SKJr  S SKJr  \R                  " S5      rSSS jjr	SSS jjr
SS jr\S	:X  a  \" \
" S
5      5        \" \
" S5      5        \" \
" S5      5        \" \
" S5      5        \" \
" S5      5        \" \
" S5      5        \" \
" S5      5        \" \
" S5      5        \" \
" S5      5        \" \
" S5      5        \" \
" S5      5        gg)    )annotationsN)cell_len)Textz(.*?\t|.+?$)c                    / nUR                   nSn[        R                  U 5      nU HC  nSnUR                  S5      (       a  USS nU[	        U5      -  nXA-  nX-
  nXG-  nU" Xg45        ME     U$ )a  Splits a string line into tuples (str, int).

Each tuple represents a section of the line which precedes a tab character.
The string is the string text that appears before the tab character (excluding the tab).
The integer is the width that the tab character is expanded to.

Args:
    line: The text to expand tabs in.
    tab_size: Number of cells in a tab.

Returns:
    A list of tuples representing the line split on tab characters,
        and the widths of the tabs after tab expansion is applied.
r   	N)append_TABS_SPLITTER_REfindallendswithr   )	linetab_sizepartsadd_partcell_positionmatchesmatchexpansion_widthtab_remainders	            e/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/textual/expand_tabs.pyget_tab_widthsr      s      $&E||HM''-G>>$#2JEXe_,M *4M&6O,M%)*  L    c           	     z    [        X5      nSR                  U VVs/ s H  u  p4X4S-  -   PM     snn5      $ s  snnf )zExpands tabs, taking into account double cell characters.

Args:
    line: The text to expand tabs in.
    tab_size: Number of cells in a tab.
Returns:
    New string with tabs replaced with spaces.
  )r   join)r   r   
tab_widthspartr   s        r   expand_tabs_inliner   1   s?      /J77CMN:*?$#%	%:N Ns   7
c                   SU R                   ;  a  U $ U R                  SSS9n[        U5      n/ nUR                  nU Hl  nUR                   R	                  S5      (       aA  UR
                  S   SS S-   UR
                  S'   [        U5      nUR                  US-
  5        U" U5        Mn     [        SSS	9R                  U5      $ )
a  Expand tabs to the widths defined in the `tab_widths` list.

This will return a new Text instance with tab characters expanded into a
number of spaces. Each time a tab is encountered, it's expanded into the
next integer encountered in the `tab_widths` list. Consequently, the length
of `tab_widths` should match the number of tab characters in `line`.

Args:
    line: The `Text` instance to expand tabs in.
    tab_widths: The widths to expand tabs to.

Returns:
    A new text instance with tab characters converted to spaces.
r   T)include_separatorr   Nr      r   )end)
plainsplititerr	   r   _textnextextend_styler   r   )r   r   r   tab_widths_iter	new_partsappend_partr   spacess           r   expand_text_tabs_from_widthsr.   @   s     4::JJttJ4E:&OI""K::t$$!ZZ^CR036DJJrN/*Ffqj)D    ++r   __main__z	barz	bar	z1	barz12	barz123	barz1234	baru   💩	baru   💩💩	baru   💩💩💩	baru	   F💩	baru
   F💩O	bar)   )r   strr   intreturnzlist[tuple[str, int]])r   r1   r   r2   r3   r1   )r   r   r   z	list[int]r3   r   )
__future__r   re
rich.cellsr   	rich.textr   compiler
   r   r   r.   __name__print r   r   <module>r<      s    " 	  JJ/ #L,B z	
W
%&	
Y
'(	
X
&'	
Y
'(	
Z
()	
[
)*	
[
)*	
_
-.	
0
12	
\
*+	
]
+, r   