;
Ñâ"Ic               @   s]   d  d l  Z  d  d l m Z Gd „  d ƒ Z d „  Z d „  Z d „  Z d „  Z d	 „  Z d S(
   i    N(   u   idleConfc             B   s;   |  Ee  Z d  d g f g Z d „  Z d „  Z d „  Z d S(   u   formatu   Format Paragraphu   <<format-paragraph>>c             C   s   | |  _  d  S(   N(   u   editwin(   u   selfu   editwin(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   __init__   s    c             C   s   d  |  _ d  S(   N(   u   Noneu   editwin(   u   self(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   close   s    c             C   sð  t  t j d d d ƒ ƒ } |  j j } |  j j ƒ  \ } } | o# | o | j | | ƒ } d } n% t | | j d ƒ ƒ \ } } } } | oÇ | j	 d ƒ } t
 t | ƒ d „ | ƒ } d j | ƒ } t | t | ƒ d ƒ }	 t | |	 ƒ }
 |
 j	 d ƒ }
 d } |
 d	 p d } |
 d  d	 … }
 n | d
 „ } d j t
 | |
 ƒ ƒ | }
 n t | | ƒ }
 | j d d d ƒ |
 | k oH | j d | ƒ | j ƒ  | j | | ƒ | j | |
 ƒ | j ƒ  n | j d | ƒ | j d ƒ d S(   Nu   mainu   FormatParagraphu	   paragraphu    u   insertu   
c             S   s   |  | d  … S(   N(    (   u   stu   l(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   <lambda>/   s    i   iÿÿÿÿc             S   s   | |  S(    (    (   u   itemu   prefix(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   <lambda>?   s    u   selu   1.0u   endu   break(   u   intu   idleConfu	   GetOptionu   editwinu   textu   get_selection_indicesu   getu   find_paragraphu   indexu   splitu   mapu   lenu   joinu   maxu   reformat_paragraphu
   tag_removeu   mark_setu   undo_block_startu   deleteu   insertu   undo_block_stopu   see(   u   selfu   eventu   maxformatwidthu   textu   firstu   lastu   datau   comment_headeru   linesu   format_widthu   newdatau   block_suffixu   builder(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   format_paragraph_event"   s>    
$ 
N(   u   Format Paragraphu   <<format-paragraph>>(   u   __name__u
   __module__u   menudefsu   __init__u   closeu   format_paragraph_event(   u
   __locals__(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   FormatParagraph   s
   
		u   FormatParagraphc       
      C   s¼  t  t | j d ƒ ƒ \ } } |  j d | d | ƒ } xP |  j d | d d ƒ o5 t | ƒ o( | d } |  j d | d | ƒ } q; W| } t | ƒ } t | ƒ } xT t | ƒ | k o@ t | | d  … ƒ o( | d } |  j d | d | ƒ } q¬ Wd | } | d } |  j d | d | ƒ } xa | d k oS t | ƒ | k o@ t | | d  … ƒ o( | d } |  j d | d | ƒ } q1Wd | d }	 |	 | | |  j |	 | ƒ f S(   Nu   .u   %d.0u   %d.0 lineendu   <u   endi   i    (   u   mapu   intu   splitu   getu   compareu   is_all_whiteu   get_comment_headeru   len(
   u   textu   marku   linenou   colu   lineu   first_linenou   comment_headeru   comment_header_lenu   lastu   first(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   find_paragraphP   s2     '
 


 
c             C   s  |  j  d ƒ } d } t | ƒ } x- | | k  o t | | ƒ o | d } q$ W| | k o |  St | | ƒ } | d | k  o. t | | d ƒ o t | | d ƒ } n | } | d  | … } | } x| | k  o t | | ƒ oî t j  d | | ƒ }	 xÇ t d t |	 ƒ d ƒ D]­ }
 |	 |
 } | p qn t | | j ƒ  ƒ | k o* | | k o | j | j ƒ  ƒ | } n | | d } |
 d t |	 ƒ k  o# |	 |
 d d k o | d } qqW| d } qÑ W| j | j ƒ  ƒ | j	 | | d  … ƒ d j
 | ƒ S(   Nu   
i    i   u   (\s+)i   u    (   u   splitu   lenu   is_all_whiteu
   get_indentu   reu   rangeu
   expandtabsu   appendu   rstripu   extendu   join(   u   datau   limitu   linesu   iu   nu   indent1u   indent2u   newu   partialu   wordsu   ju   word(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   reformat_paragraphi   sB     '  

,c             C   s   t  j d |  ƒ d  k	 S(   Nu   ^\s*$(   u   reu   matchu   None(   u   line(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   is_all_whiteŒ   s    c             C   s   t  j d |  ƒ j ƒ  S(   Nu   ^(\s*)(   u   reu   matchu   group(   u   line(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu
   get_indent   s    c             C   s1   t  j d |  ƒ } | d  k o d S| j d ƒ S(   Nu   ^(\s*#*)u    i   (   u   reu   matchu   Noneu   group(   u   lineu   m(    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   get_comment_header’   s     (	   u   reu   idlelib.configHandleru   idleConfu   FormatParagraphu   find_paragraphu   reformat_paragraphu   is_all_whiteu
   get_indentu   get_comment_header(    (    (    u4   /mit/python/lib/python3.0/idlelib/FormatParagraph.pyu   <module>   s   <		#		