
    ^h'                        % S SK Jr  S SKJr  S SKJrJr  S SKJr  S SK	J
r
  S SKJr  \(       a  SSKJr  S	S
/r " S S
5      r\" \SS9rS\S'   Sr " S S	5      r " S S5      rg)    )annotationsdefaultdict)TYPE_CHECKINGCallable)FastDictCache)Point)
get_cwidth   )WindowScreenCharc                     \ rS rSr% SrSr0 SS_SS_SS	_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S!_S"S#_S$S%_0 S&S'_S(S)_S*S+_S,S-_S.S/_S0S1_S2S3_S4S5_S6S7_S8S9_S:S;_S<S=_S>S?_S@SA_SBSC_SDSE_SFSG_E0 SHSI_SJSK_SLSM_SNSO_SPSQ_SRSS_STSU_SVSW_SXSY_SZS[_S\S]_S^S__S`Sa_SbSc_SdSe_SfSg_ShSi_ESjSkSlSmSnSoSpSqSrSsStSuSvSwSxSy.ErSz\S{'   SSS| jjrSS} jr	SS~ jr
\(       d  \	r\
rSS jrSrg)r      z
Represent a single character in a :class:`.Screen`.

This should be considered immutable.

:param char: A single character (can be a double-width character).
:param style: A style string. (Can contain classnames.)
)charstylewidth z^@z^Az^Bz^Cz^Dz^Ez^Fz^Gz^H	z^I
z^Jz^Kz^Lz^Mz^Nz^Oz^Pz^Qz^Rz^Sz^Tz^Uz^Vz^Wz^Xz^Yz^Zz^[z^\z^]z^^z^_z^?   z<80>   z<81>   z<82>   z<83>   z<84>   z<85>   z<86>   z<87>   z<88>   z<89>   z<8a>   z<8b>   z<8c>   z<8d>   z<8e>   z<8f>   z<90>   z<91>z<92>z<93>z<94>z<95>z<96>z<97>z<98>z<99>z<9a>z<9b>z<9c>z<9d>z<9e>z<9f> )                                              zdict[str, str]display_mappingsc                    XR                   ;   a   US:X  a  US-  nOUS-  nU R                   U   nXl        X l        [        U5      U l        g )NrV   z class:nbsp z class:control-character )rW   r   r   r
   r   )selfr   r   s      V/home/james-whalen/.local/lib/python3.13/site-packages/prompt_toolkit/layout/screen.py__init__Char.__init__l   sR    (((v~'44((.D	
  %
    c                t    U R                   UR                   :H  =(       a    U R                  UR                  :H  $ Nr   r   rY   others     rZ   _equalChar._equal   s'    yyEJJ&D4::+DDr]   c                t    U R                   UR                   :g  =(       d    U R                  UR                  :g  $ r_   r`   ra   s     rZ   
_not_equalChar._not_equal   s)     yyEJJ&C$***CCr]   c                l    U R                   R                   SU R                  < SU R                  < S3$ )N(z, ))	__class____name__r   r   rY   s    rZ   __repr__Char.__repr__   s.    ..))*!DII=4::.JJr]   N)rG    )r   strr   rq   returnNone)rb   r   rr   boolrr   rq   )rl   
__module____qualname____firstlineno____doc__	__slots__rW   __annotations__r[   rc   rf   r   __eq____ne__rn   __static_attributes__ r]   rZ   r   r      s:    +I
G(G(G( 	G( 		G(
 	G( 	G( 	G( 	G( 	G( 	G( 	G( 	G( 	G( 	G( 	G(  	!G(" 	#G($ 	%G(& 	'G(( 	)G(* 	+G(, 	-G(. 	/G(0 	1G(2 	3G(4 	5G(6 	7G(8 	9G(: 	;G(< 	=G(> 	?G(@ 	AG(B 	CG(F 	GG(H 	IG(J 	KG(L 	MG(N 	OG(P 	QG(R 	SG(T 	UG(V 	WG(X 	YG(Z 	[G(\ 	]G(^ 	_G(` 	aG(b 	cG(d 	eG(f 	gG(h 	iG(j  MG(n GR&(ED
 Kr]   i@B )sizez$FastDictCache[tuple[str, str], Char]_CHAR_CACHEz[transparent]c                      \ rS rSrSr   S       SS jjr\SS j5       rSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jr S       SS jjrSrg)r      z5
Two dimensional buffer of :class:`.Char` instances.
Nc                   ^ Uc  [         S[        4   mOUm[        U4S j5      U l        [        S 5      U l        0 U l        SU l        0 U l        U=(       d    SU l        U=(       d    SU l	        0 U l
        / U l        g )NrG   c                 "   > [        U 4S j5      $ )Nc                    > T $ r_   r   default_char2s   rZ   <lambda>3Screen.__init__.<locals>.<lambda>.<locals>.<lambda>   s    r]   r   r   s   rZ   r   !Screen.__init__.<locals>.<lambda>   s    K 56r]   c                      [        [        5      $ r_   )r   rq   r   r]   rZ   r   r      s	    K$r]   Tr   )r   Transparentr   data_bufferzero_width_escapescursor_positionsshow_cursormenu_positionsr   height"visible_windows_to_write_positions_draw_float_functions)rY   default_charinitial_widthinitial_heightr   s       @rZ   r[   Screen.__init__   s     '[(89M(MEP6F

 LW$L
  	
    	 #'a
$) PR/ LN"r]   c                H    [        U R                  R                  5       5      $ r_   )listr   keysrm   s    rZ   visible_windowsScreen.visible_windows   s    D;;@@BCCr]   c                     X R                   U'   gz-
Set the cursor position for a given window.
N)r   rY   windowpositions      rZ   set_cursor_positionScreen.set_cursor_position   s     )1f%r]   c                     X R                   U'   gr   )r   r   s      rZ   set_menu_positionScreen.set_menu_position   s     '/F#r]   c                V     U R                   U   $ ! [         a    [        SSS9s $ f = f)z@
Get the cursor position for a given window.
Returns a `Point`.
r   xy)r   KeyErrorr	   rY   r   s     rZ   get_cursor_positionScreen.get_cursor_position   s3    
	#((00 	#1?"	#s    ((c                     U R                   U   $ ! [         a/     U R                  U   s $ ! [         a    [        SSS9s s $ f = ff = f)zq
Get the menu position for a given window.
(This falls back to the cursor position if no menu position was set.)
r   r   )r   r   r   r	   r   s     rZ   get_menu_positionScreen.get_menu_position   sX    
	'&&v.. 	'',,V44 'qA&'	's)    
A
-A
AA
AA
c                <    U R                   R                  X45        g)zx
Add a draw-function for a `Window` which has a >= 0 z_index.
This will be postponed until `draw_all_floats` is called.
N)r   append)rY   z_index	draw_funcs      rZ   draw_with_z_indexScreen.draw_with_z_index   s    
 	""))7*>?r]   c                    U R                   (       a@  [        U R                   S S9nUSS U l         US   S   " 5         U R                   (       a  M?  gg)z/
Draw all float functions in order of z-index.
c                    U S   $ Nr   r   )items    rZ   r   (Screen.draw_all_floats.<locals>.<lambda>  s	    DQRGr]   )keyr   Nr   )r   sorted)rY   	functionss     rZ   draw_all_floatsScreen.draw_all_floats   sL     ((t99?STI *312D&aLO (((r]   c                    U R                   n[        nSU-   nUR                  5        H=  u  pVUR                  5        H$  u  pxX8R                  UR                  U-   4   Xg'   M&     M?     g)zV
For all the characters in the screen.
Set the style string to the given `style_str`.
rG   N)r   r   itemsr   r   )	rY   	style_strb
char_cacheappend_styler   rowr   r   s	            rZ   append_style_to_contentScreen.append_style_to_content  s]    
  
YggiFA99;#IItzzL/H$HI '  r]   c                   UR                  5       (       d  gUR                  nUR                  UR                  -   n[        nU R                  nU(       a  SU-   nSn	OSnUS-   n	[        UR                  UR                  UR                  -   5       H?  n
Xz   n[        XE5       H)  nX   nUUR                  XR                  -   U-   4   X'   M+     MA     g)zq
Fill the content of this area, using the given `style`.
The style is prepended before whatever was here before.
NrG   rp   )
stripxposr   r   r   rangeyposr   r   r   )rY   write_positionr   afterxminxmaxr   r   r   prepend_styler   r   r   cells                 rZ   	fill_areaScreen.fill_area  s     {{}}""""^%9%99 
&&;LML!CKM!4!4~7L7L!L
A .C4&v#II}zz9LHH '	
r]   )	r   r   r   r   r   r   r   r   r   )Nr   r   )r   zChar | Noner   intr   r   rr   rs   )rr   zlist[Window])r   r   r   r	   rr   rs   )r   r   rr   r	   )r   r   r   zCallable[[], None]rr   rs   )rr   rs   )r   rq   rr   rs   )rp   F)r   WritePositionr   rq   r   rt   rr   rs   )rl   rv   rw   rx   ry   r[   propertyr   r   r   r   r   r   r   r   r   r~   r   r]   rZ   r   r      s     %)	.N!.N .N 	.N
 
.N` D D1/#'@J MR+47EI	 r]   c                  (    \ rS rSrSS jrSS jrSrg)r   i7  c                T    US:  d   eUS:  d   eXl         X l        X0l        X@l        g r   )r   r   r   r   )rY   r   r   r   r   s        rZ   r[   WritePosition.__init__8  s0    {{zz 		
r]   c           
         U R                   R                   SU R                  < SU R                  < SU R                  < SU R
                  < S3
$ )Nz(x=z, y=z, width=z	, height=rj   )rk   rl   r   r   r   r   rm   s    rZ   rn   WritePosition.__repr__B  sL    ..))*#dii]$tyym8TXT^T^Saajkokvkvjyyz{{r]   )r   r   r   r   N)
r   r   r   r   r   r   r   r   rr   rs   ru   )rl   rv   rw   rx   r[   rn   r~   r   r]   rZ   r   r   7  s    |r]   r   N)
__future__r   collectionsr   typingr   r   prompt_toolkit.cacher   prompt_toolkit.data_structuresr	   prompt_toolkit.utilsr
   
containersr   __all__r   r   r{   r   r   r   r   r]   rZ   <module>r      su    " # * . 0 +" 
yK yKx 5B{51  ^ ^B| |r]   