
    z%i                     V    	 d dl Z d dlZ G d d      Zedk(  rd dlmZ  edd       yy)	    Nc                   \    e Zd Zej                  ej
                  z   dz   Zd Zd Zd Z	d Z
y)
AutoExpand_c                 j    |j                   | _         | j                   j                  | _        d | _        y )N)textbellstate)selfeditwins     F/home/uftp/.pyenv/versions/3.12.0/lib/python3.12/idlelib/autoexpand.py__init__zAutoExpand.__init__   s#    LL	IINN	
    c                    	 | j                   j                  d      }| j                   j                  dd      }| j                  s| j	                         }d}n-| j                  \  }}}}||k7  s||k7  r| j	                         }d}|s| j                          y| j                         }| j                   j                  dt        |      z  d       ||   }	|dz   t        |      z  }|dk(  r| j                          | j                   j                  d|	       | j                   j                  d      }| j                   j                  dd      }||||f| _        y)Ninsertinsert linestartzinsert lineendr   breakzinsert - %d chars   )
r   indexgetr	   getwordsr   getprevworddeletelenr   )
r
   event	curinsertcurlinewordsr   r   linewordnewwords
             r   expand_word_eventzAutoExpand.expand_word_event   s)   ;IIOOH-	))-- 24DEzzMMOEE)-&E5&$"dgoIIK!		,s4y8(C,c%j(A:IIK		7+IIOOH-	))-- 24DEE9g5
r   c                 &   	 | j                         }|sg S | j                  j                  dd      }t        j                  d|z   dz   |      }~| j                  j                  dd      }t        j                  d|z   dz   |      }~|s|sg S g }i }|j                          |D ]*  }|j                  |      r|j                  |       |||<   , |D ]*  }|j                  |      r|j                  |       |||<   , |j                  |       |S )Nz1.0zinsert wordstartz\bz\w+\bzinsert wordendend)r   r   r   refindallreverseappend)	r
   r   beforewbeforeafterwafterr   dictws	            r   r   zAutoExpand.getwords6   s   I!Iu&89**UT\H4f=		.6EDL83U;vI 	Axx{LLODG		  	Axx{LLODG		
 	Tr   c                     	 | j                   j                  dd      }t        |      }|dkD  r3||dz
     | j                  v r|dz
  }|dkD  r||dz
     | j                  v r||d  S )Nr   r   r   r   )r   r   r   	wordchars)r
   r   is      r   r   zAutoExpand.getprevwordU   sm    3yy}}/:I!eQqS	T^^3!A !eQqS	T^^3ABxr   N)__name__
__module____qualname__stringascii_lettersdigitsr/   r   r!   r   r    r   r   r   r      s/    $$v}}4s:I
6>r   r   __main__)mainz!idlelib.idle_test.test_autoexpand   )	verbosity)r$   r4   r   r1   unittestr9   r7   r   r   <module>r=      s<    
 H HV z	,: r   