+
    j,i                        R t ^ RIHt ^ RIHtHt ^ RIHt ^RIH	t	H
t
HtHt . ROtR R ltR R ltR	 R
 ltR R ltR R ltR# )z
Utilities for manipulating formatted text.

When ``to_formatted_text`` has been called, we get a list of ``(style, text)``
tuples. This file contains functions for manipulating such a list.
)annotations)Iterablecast
get_cwidth)AnyFormattedTextOneStyleAndTextTupleStyleAndTextTuplesto_formatted_textc                    V ^8  d   QhRRRR/# )   valuer   returnstr )formats   "E/usr/lib/python3/dist-packages/prompt_toolkit/formatted_text/utils.py__annotate__r      s     ; ;) ;c ;    c                *    \        \        V 4      4      # )z7
Turn any kind of formatted text back into plain text.
)fragment_list_to_textr
   )r   s   &r   to_plain_textr      s     !!25!9::r   c                    V ^8  d   QhRRRR/# r   	fragmentsr	   r   intr   )r   s   "r   r   r   %   s     U U!3 U Ur   c                2   a Ro\        V3R lV  4       4      # )z
Return the amount of characters in this text fragment list.

:param fragments: List of ``(style_str, text)`` or
    ``(style_str, text, mouse_handler)`` tuples.
[ZeroWidthEscape]c              3  h   <"   T F'  pSV^ ,          9  g   K  \        V^,          4      x  K)  	  R# 5i    N)len.0itemZeroWidthEscapes   & r   	<genexpr>$fragment_list_len.<locals>.<genexpr>-   s)     T	_DQRG5S|s47||	s   22sumr   r%   s   &@r   fragment_list_lenr+   %   s     *OT	TTTr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   0   s      #5 # r   c                2   a Ro\        V3R lV  4       4      # )z
Return the character width of this text fragment list.
(Take double width characters into account.)

:param fragments: List of ``(style_str, text)`` or
    ``(style_str, text, mouse_handler)`` tuples.
r   c              3  z   <"   T F0  pV^,           F   pSV^ ,          9  g   K  \        V4      x  K"  	  K2  	  R# 5i)   Nr   )r#   r$   cr%   s   &  r   r&   &fragment_list_width.<locals>.<genexpr>9   s?      DaA$q') 	
1 	s   ;;r(   r*   s   &@r   fragment_list_widthr2   0   s$     *O   r   c                    V ^8  d   QhRRRR/# )r   r   r	   r   r   r   )r   s   "r   r   r   A   s     T T%7 TC Tr   c                >   a RoRP                  V3R lV  4       4      # )z
Concatenate all the text parts again.

:param fragments: List of ``(style_str, text)`` or
    ``(style_str, text, mouse_handler)`` tuples.
r    c              3  V   <"   T F  pSV^ ,          9  g   K  V^,          x  K   	  R# 5ir   r   r"   s   & r   r&   (fragment_list_to_text.<locals>.<genexpr>I   s%     SytO4PQ74R7477ys   )))joinr*   s   &@r   r   r   A   s     *O77SySSSr   c                    V ^8  d   QhRRRR/# )r   r   zIterable[OneStyleAndTextTuple]r   zIterable[StyleAndTextTuples]r   )r   s   "r   r   r   L   s      -!r   c           	   #    "   . pV  Fu  vr#pVP                  R4      pVRR  F,  pVP                  \        \        W&.VO54      4       Vx  . pK.  	  VP                  \        \        W%R,          .VO54      4       Kw  	  Vx  R# 5i)z
Take a single list of (style_str, text) tuples and yield one such list for each
line. Just like str.split, this will yield at least one item.

:param fragments: Iterable of ``(style_str, text)`` or
    ``(style_str, text, mouse_handler)`` tuples.

N)splitappendr   r   )r   linestylestringmouse_handlerpartsparts   &      r   split_linesrE   L   s       "D)2%T"#2JDKK1E3P-3PQRJD 
 	D-Ry/Q=/QRS *3 Js   BBN)r   r+   r2   r   rE   )__doc__
__future__r   typingr   r   prompt_toolkit.utilsr   baser   r   r	   r
   __all__r   r+   r2   r   rE   r   r   r   <module>rL      sA    # ! + ;U"Tr   