Current File : //usr/local/apps/python3/lib/python3.11/idlelib/__pycache__/autoexpand.cpython-311.opt-2.pyc
�

�Ke���h�	ddlZddlZGd�d��ZedkrddlmZedd���dSdS)	�Nc�J�eZdZejejzdzZd�Zd�Zd�Z	d�Z
dS)�
AutoExpand�_c�N�|j|_|jj|_d|_dS)N)�text�bell�state)�self�editwins  �</usr/local/apps/python3/lib/python3.11/idlelib/autoexpand.py�__init__zAutoExpand.__init__s!���L��	��I�N��	���
�
�
�c���	|j�d��}|j�dd��}|js|���}d}n.|j\}}}}||ks||kr|���}d}|s|���dS|���}|j�dt|��zd��||}	|dzt|��z}|dkr|���|j�	d|	��|j�d��}|j�dd��}||||f|_dS)N�insert�insert linestartzinsert lineendr�breakzinsert - %d chars�)
r�index�getr	�getwordsr�getprevword�delete�lenr)
r
�event�	curinsert�curline�wordsrr�line�word�newwords
          r�expand_word_eventzAutoExpand.expand_word_events[��;��I�O�O�H�-�-�	��)�-�-� 2�4D�E�E���z�	��M�M�O�O�E��E�E�)-��&�E�5�&�$���"�"�d�g�o�o��
�
�������	��I�I�K�K�K��7����!�!���	���,�s�4�y�y�8�(�C�C�C���,�����c�%�j�j�(���A�:�:��I�I�K�K�K��	����7�+�+�+��I�O�O�H�-�-�	��)�-�-� 2�4D�E�E���E�9�g�5��
��wrc�N�	|���}|sgS|j�dd��}tjd|zdz|��}~|j�dd��}tjd|zdz|��}~|s|sgSg}i}|���|D]2}|�|��r�|�|��|||<�3|D]2}|�|��r�|�|��|||<�3|�|��|S)Nz1.0zinsert wordstartz\bz\w+\bzinsert wordend�end)rrr�re�findall�reverse�append)	r
r�before�wbefore�after�wafterr�dict�ws	         rrzAutoExpand.getwords6sJ��I����!�!���	��I�����u�&8�9�9���*�U�T�\�H�4�f�=�=����	�
�
�.��6�6����E�D�L�8�3�U�;�;����	�v�	��I������������	�	�A��x�x��{�{�
���L�L��O�O�O��D��G�G��	�	�A��x�x��{�{�
���L�L��O�O�O��D��G�G�
���T�����rc���	|j�dd��}t|��}|dkr/||dz
|jvr|dz
}|dkr||dz
|jv�||d�S)Nrrrr)rrr�	wordchars)r
r�is   rrzAutoExpand.getprevwordUsx��3��y�}�}�/��:�:����I�I���!�e�e��Q�q�S�	�T�^�3�3��!��A��!�e�e��Q�q�S�	�T�^�3�3��A�B�B�x�rN)�__name__�
__module__�__qualname__�string�
ascii_letters�digitsr/r
r!rr�rrrrsd�������$�v�}�4�s�:�I����
���6���>����rr�__main__)�mainz!idlelib.idle_test.test_autoexpand�)�	verbosity)r$r4rr1�unittestr9r7rr�<module>r=s���
�
�	�	�	�
�
�
�
�H�H�H�H�H�H�H�H�V�z����������D�	,��:�:�:�:�:�:��r