File: //usr/lib64/python2.7/idlelib/FormatParagraph.pyc
�
{fc           @   s�   d  Z  d d l Z d d l m Z d d d �  �  YZ d �  Z d �  Z d �  Z d	 �  Z d
 �  Z	 d �  Z
 e d k r� d d l Z e j
 d
 d d d e �n  d S(   s�  Extension to format a paragraph or selection to a max width.
Does basic, standard text formatting, and also understands Python
comment blocks. Thus, for editing Python source code, this
extension is really only suitable for reformatting these comment
blocks or triple-quoted strings.
Known problems with comment reformatting:
* If there is a selection marked, and the first line of the
  selection is not complete, the block will probably not be detected
  as comments, and will have the normal "text formatting" rules
  applied.
* If a comment block has leading whitespace that mixes tabs and
  spaces, they will not be considered part of the same block.
* Fancy comments, like this bulleted list, aren't handled :-)
i����N(   t   idleConft   FormatParagraphc           B   s8   e  Z d  d g f g Z d �  Z d �  Z d d � Z RS(   t   formats   Format Paragraphs   <<format-paragraph>>c         C   s
   | |  _  d  S(   N(   t   editwin(   t   selfR   (    (    s/   /usr/lib64/python2.7/idlelib/FormatParagraph.pyt   __init__   s    c         C   s
   d  |  _ d  S(   N(   t   NoneR   (   R   (    (    s/   /usr/lib64/python2.7/idlelib/FormatParagraph.pyt   close    s    c   	      C   sS  | d
 k r0 t j d d d d d d d �} n  |  j j } |  j j �  \ } } | r~ | r~ | j | | � } t | � } n$ t | | j	 d � � \ } } } } | r� t
 | | | � } n t | | � } | j d	 d
 d � | | k r2| j
 d | � | j �  | j | | � | j | | � | j �  n | j
 d | � | j d � d S(   s�  Formats paragraph to a max width specified in idleConf.
        If text is selected, format_paragraph_event will start breaking lines
        at the max width, starting from the beginning selection.
        If no text is selected, format_paragraph_event uses the current
        cursor location to determine the paragraph (lines of text surrounded
        by blank lines) and formats it.
        The length limit parameter is for testing with a known value.
        t
   extensionsR   s	   max-widtht   typet   intt   defaultiH   t   insertt   sels   1.0t   endt   breakN(   R   R    t	   GetOptionR   t   textt   get_selection_indicest   gett   get_comment_headert   find_paragrapht   indext   reformat_commentt   reformat_paragrapht
   tag_removet   mark_sett   undo_block_startt   deleteR   t   undo_block_stopt   see(	   R   t   eventt   limitR   t   firstt   lastt   datat   comment_headert   newdata(    (    s/   /usr/lib64/python2.7/idlelib/FormatParagraph.pyt   format_paragraph_event#   s.    $
(   s   Format Paragraphs   <<format-paragraph>>N(   t   __name__t
   __module__t   menudefsR   R   R   R&