
    "e                         d Z ddlmZ ddlmZ d Z G d d      Zej                          edk(  rddl	Z	 e	j                  d	d
d       yy)zExample extension, also used for testing.

See extend.txt for more details on creating an extension.
See config-extension.def for configuring an extension.
    )idleConfwrapsc                 0     t               d fd	       }|S )z9Apply a formatting function to all of the selected lines.c                     | j                   j                         \  }}}}t        t        |      dz
        D ]  }||   } | |      ||<    | j                   j	                  ||||       y)N   break)	formatter
get_regionrangelen
set_region)	selfeventheadtailcharslinesposlineformat_lines	           !lib/python3.12/idlelib/zzdummy.pyapplyzformat_selection.<locals>.apply   sp    #'>>#<#<#> dE5Ua( 	1C:D$T40E#J	1 	!!$eU;    )Nr   )r   r   s   ` r   format_selectionr      s#     ;  Lr   c                   T    e Zd ZdZdddgfgZd Zed        Zed        Z	ed        Z
y	)
ZzDummyz3Prepend or remove initial text from selected lines.format)zZ inz<<z-in>>)zZ outz	<<z-out>>c                 V    || _         |j                  | _        |j                  | _        y)z+Initialize the settings for this extension.N)editwintextfregionr
   )r   r    s     r   __init__zZzDummy.__init__%   s    LL	 r   c                 <    t        j                  ddd      | _        y)z!Load class variables from config.
extensionsr   zz-textN)r   	GetOptionztext)clss    r   reloadzZzDummy.reload+   s     &&|YI	r   c                 "    | j                    | S )zInsert text at the beginning of each selected line.

        This is bound to the <<z-in>> virtual event when the extensions
        are loaded.
        )r'   )r   r   s     r   
z_in_eventzZzDummy.z_in_event0   s     **dV$$r   c                 p    |j                  | j                        sdnt        | j                        }||d S )zRemove specific text from the beginning of each selected line.

        This is bound to the <<z-out>> virtual event when the extensions
        are loaded.
        r   N)
startswithr'   r   )r   r   zlengths      r   z_out_eventzZzDummy.z_out_event9   s.      ??4::6!C

OGH~r   N)__name__
__module____qualname____doc__menudefsr#   classmethodr)   r   r+   r/    r   r   r   r      sd    = 
 "
 	H) J J % %  r   r   __main__Nzidlelib.idle_test.test_zzdummy   F)	verbosityexit)r3   idlelib.configr   	functoolsr   r   r   r)   r0   unittestmainr6   r   r   <module>r?      sS    $ ' 'T   zHMM2aeL r   